Compare commits
No commits in common. "622b0d51b040b89c189267b11136faacee9c0f1f" and "d19a39239d8dc2964618e610db53889e7b30abbc" have entirely different histories.
622b0d51b0
...
d19a39239d
|
@ -59,7 +59,6 @@ dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"built",
|
"built",
|
||||||
"clap",
|
"clap",
|
||||||
"clap_complete",
|
|
||||||
"hex",
|
"hex",
|
||||||
"ignore",
|
"ignore",
|
||||||
"indoc",
|
"indoc",
|
||||||
|
@ -494,15 +493,6 @@ dependencies = [
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clap_complete"
|
|
||||||
version = "4.3.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5fc443334c81a804575546c5a8a79b4913b50e28d69232903604cada1de817ce"
|
|
||||||
dependencies = [
|
|
||||||
"clap",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_derive"
|
name = "clap_derive"
|
||||||
version = "4.2.0"
|
version = "4.2.0"
|
||||||
|
|
|
@ -31,7 +31,6 @@ aiken-lang = { path = "../aiken-lang", version = "1.0.13-alpha" }
|
||||||
aiken-lsp = { path = "../aiken-lsp", version = "1.0.13-alpha" }
|
aiken-lsp = { path = "../aiken-lsp", version = "1.0.13-alpha" }
|
||||||
aiken-project = { path = '../aiken-project', version = "1.0.13-alpha" }
|
aiken-project = { path = '../aiken-project', version = "1.0.13-alpha" }
|
||||||
uplc = { path = '../uplc', version = "1.0.13-alpha" }
|
uplc = { path = '../uplc', version = "1.0.13-alpha" }
|
||||||
clap_complete = "4.3.2"
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
built = { version = "0.6.0", features = ["git2"] }
|
built = { version = "0.6.0", features = ["git2"] }
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
use clap::{Command, Subcommand};
|
|
||||||
use clap_complete::{generate, Shell};
|
|
||||||
|
|
||||||
use crate::cmd::Cmd as MainCmd;
|
|
||||||
|
|
||||||
/// Generates shell completion scripts
|
|
||||||
#[derive(Subcommand)]
|
|
||||||
pub enum Cmd {
|
|
||||||
Bash,
|
|
||||||
Zsh,
|
|
||||||
Fish,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn exec(sub_cmd: Cmd) -> miette::Result<()> {
|
|
||||||
let shell = match sub_cmd {
|
|
||||||
Cmd::Bash => Shell::Bash,
|
|
||||||
Cmd::Zsh => Shell::Zsh,
|
|
||||||
Cmd::Fish => Shell::Fish,
|
|
||||||
};
|
|
||||||
|
|
||||||
let cli = Command::new("aiken").disable_version_flag(true);
|
|
||||||
|
|
||||||
let mut main = MainCmd::augment_subcommands(cli);
|
|
||||||
|
|
||||||
generate(
|
|
||||||
shell,
|
|
||||||
&mut main,
|
|
||||||
"aiken".to_string(),
|
|
||||||
&mut std::io::stdout(),
|
|
||||||
);
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
|
@ -1,9 +1,6 @@
|
||||||
use clap::Parser;
|
|
||||||
|
|
||||||
pub mod blueprint;
|
pub mod blueprint;
|
||||||
pub mod build;
|
pub mod build;
|
||||||
pub mod check;
|
pub mod check;
|
||||||
pub mod completion;
|
|
||||||
pub mod docs;
|
pub mod docs;
|
||||||
pub mod fmt;
|
pub mod fmt;
|
||||||
pub mod lsp;
|
pub mod lsp;
|
||||||
|
@ -11,51 +8,3 @@ pub mod new;
|
||||||
pub mod packages;
|
pub mod packages;
|
||||||
pub mod tx;
|
pub mod tx;
|
||||||
pub mod uplc;
|
pub mod uplc;
|
||||||
|
|
||||||
use crate::built_info;
|
|
||||||
|
|
||||||
/// Aiken: a smart-contract language and toolchain for Cardano
|
|
||||||
#[derive(Parser)]
|
|
||||||
#[clap(version = version(), about, long_about = None)]
|
|
||||||
#[clap(propagate_version = true)]
|
|
||||||
pub enum Cmd {
|
|
||||||
New(new::Args),
|
|
||||||
Fmt(fmt::Args),
|
|
||||||
Build(build::Args),
|
|
||||||
Address(blueprint::address::Args),
|
|
||||||
Check(check::Args),
|
|
||||||
Docs(docs::Args),
|
|
||||||
Add(packages::add::Args),
|
|
||||||
|
|
||||||
#[clap(subcommand)]
|
|
||||||
Blueprint(blueprint::Cmd),
|
|
||||||
|
|
||||||
#[clap(subcommand)]
|
|
||||||
Packages(packages::Cmd),
|
|
||||||
|
|
||||||
#[clap(subcommand)]
|
|
||||||
Tx(tx::Cmd),
|
|
||||||
|
|
||||||
#[clap(subcommand)]
|
|
||||||
Uplc(uplc::Cmd),
|
|
||||||
|
|
||||||
#[clap(subcommand)]
|
|
||||||
Completion(completion::Cmd),
|
|
||||||
|
|
||||||
#[clap(hide = true)]
|
|
||||||
Lsp(lsp::Args),
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for Cmd {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::parse()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn version() -> String {
|
|
||||||
format!(
|
|
||||||
"v{} {}",
|
|
||||||
built_info::PKG_VERSION,
|
|
||||||
built_info::GIT_COMMIT_HASH_SHORT.unwrap_or("unknown")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ pub struct Args {
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
pub version: String,
|
pub version: String,
|
||||||
|
|
||||||
#[clap(hide = true, long)]
|
#[clap(hide = true)]
|
||||||
pub overwrite: bool,
|
pub overwrite: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,50 @@
|
||||||
use aiken::cmd::{
|
use aiken::{
|
||||||
|
built_info,
|
||||||
|
cmd::{
|
||||||
blueprint::{self, address},
|
blueprint::{self, address},
|
||||||
build, check, completion, docs, fmt, lsp, new,
|
build, check, docs, fmt, lsp, new,
|
||||||
packages::{self, add},
|
packages::{self, add},
|
||||||
tx, uplc, Cmd,
|
tx, uplc,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
use clap::Parser;
|
||||||
use owo_colors::OwoColorize;
|
use owo_colors::OwoColorize;
|
||||||
|
|
||||||
|
/// Aiken: a smart-contract language and toolchain for Cardano
|
||||||
|
#[derive(Parser)]
|
||||||
|
#[clap(version = version(), about, long_about = None)]
|
||||||
|
#[clap(propagate_version = true)]
|
||||||
|
pub enum Cmd {
|
||||||
|
New(new::Args),
|
||||||
|
Fmt(fmt::Args),
|
||||||
|
Build(build::Args),
|
||||||
|
Address(address::Args),
|
||||||
|
Check(check::Args),
|
||||||
|
Docs(docs::Args),
|
||||||
|
Add(add::Args),
|
||||||
|
|
||||||
|
#[clap(subcommand)]
|
||||||
|
Blueprint(blueprint::Cmd),
|
||||||
|
|
||||||
|
#[clap(subcommand)]
|
||||||
|
Packages(packages::Cmd),
|
||||||
|
|
||||||
|
#[clap(subcommand)]
|
||||||
|
Tx(tx::Cmd),
|
||||||
|
|
||||||
|
#[clap(subcommand)]
|
||||||
|
Uplc(uplc::Cmd),
|
||||||
|
|
||||||
|
#[clap(hide = true)]
|
||||||
|
Lsp(lsp::Args),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Cmd {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::parse()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn main() -> miette::Result<()> {
|
fn main() -> miette::Result<()> {
|
||||||
panic_handler();
|
panic_handler();
|
||||||
|
|
||||||
|
@ -23,10 +61,20 @@ fn main() -> miette::Result<()> {
|
||||||
Cmd::Lsp(args) => lsp::exec(args),
|
Cmd::Lsp(args) => lsp::exec(args),
|
||||||
Cmd::Tx(sub_cmd) => tx::exec(sub_cmd),
|
Cmd::Tx(sub_cmd) => tx::exec(sub_cmd),
|
||||||
Cmd::Uplc(sub_cmd) => uplc::exec(sub_cmd),
|
Cmd::Uplc(sub_cmd) => uplc::exec(sub_cmd),
|
||||||
Cmd::Completion(sub_cmd) => completion::exec(sub_cmd),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn version() -> String {
|
||||||
|
use std::env;
|
||||||
|
let nix_git_rev = env::var("GIT_REVISION").unwrap_or("unknown".to_string());
|
||||||
|
|
||||||
|
format!(
|
||||||
|
"v{} {}",
|
||||||
|
built_info::PKG_VERSION,
|
||||||
|
built_info::GIT_COMMIT_HASH_SHORT.unwrap_or(&nix_git_rev)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fn panic_handler() {
|
fn panic_handler() {
|
||||||
std::panic::set_hook(Box::new(move |info| {
|
std::panic::set_hook(Box::new(move |info| {
|
||||||
let message = info
|
let message = info
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1689068808,
|
"lastModified": 1681202837,
|
||||||
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -38,11 +38,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1690463849,
|
"lastModified": 1682773483,
|
||||||
"narHash": "sha256-n/ej009hs6+q/wxPR+OlYrNMXXv9qVK+FRyl7IyDuG0=",
|
"narHash": "sha256-FN7Zf+gQpYQUzt9LeJv6yGnvbqaBb97RjFtNnfu9OB4=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "3173ae5d63ebd44ce99b70965557906800a1fb02",
|
"rev": "d7fa40f31e8c8fa46f5d06b0cd0cb02f0d4c3fa0",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -80,11 +80,11 @@
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1690424156,
|
"lastModified": 1682734733,
|
||||||
"narHash": "sha256-Bpml+L280tHTQpwpC5/BJbU4HSvEzMvW8IZ4gAXimhE=",
|
"narHash": "sha256-oAoNMgWQveSF1Vv16OJ2GVU+BGGdzazTHpPu/VKy/BQ=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "f335a0213504c7e6481c359dc1009be9cf34432c",
|
"rev": "0bb45c519ebd64f6b4223e1bb6b4e08df80834ca",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
38
flake.nix
38
flake.nix
|
@ -17,6 +17,8 @@
|
||||||
lib.optionals stdenv.isDarwin
|
lib.optionals stdenv.isDarwin
|
||||||
[ darwin.apple_sdk.frameworks.Security ];
|
[ darwin.apple_sdk.frameworks.Security ];
|
||||||
|
|
||||||
|
deno = nixpkgs.legacyPackages.${system}.deno;
|
||||||
|
|
||||||
cargoTomlContents = builtins.readFile ./crates/aiken/Cargo.toml;
|
cargoTomlContents = builtins.readFile ./crates/aiken/Cargo.toml;
|
||||||
version = (builtins.fromTOML cargoTomlContents).package.version;
|
version = (builtins.fromTOML cargoTomlContents).package.version;
|
||||||
|
|
||||||
|
@ -27,22 +29,12 @@
|
||||||
|
|
||||||
buildInputs = with pkgs; [ openssl ] ++ osxDependencies;
|
buildInputs = with pkgs; [ openssl ] ++ osxDependencies;
|
||||||
nativeBuildInputs = with pkgs; [ pkg-config openssl.dev ];
|
nativeBuildInputs = with pkgs; [ pkg-config openssl.dev ];
|
||||||
|
cargoBuildFlags = [ "--package aiken" ];
|
||||||
|
|
||||||
src = pkgs.lib.cleanSourceWith { src = self; };
|
src = pkgs.lib.cleanSourceWith { src = self; };
|
||||||
|
|
||||||
cargoLock.lockFile = ./Cargo.lock;
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
|
|
||||||
postInstall = ''
|
|
||||||
mkdir -p $out/share/zsh/site-functions
|
|
||||||
$out/bin/aiken completion zsh > $out/share/zsh/site-functions/_aiken
|
|
||||||
|
|
||||||
mkdir -p $out/share/bash-completion/completions
|
|
||||||
$out/bin/aiken completion bash > $out/share/bash-completion/completions/aiken
|
|
||||||
|
|
||||||
mkdir -p $out/share/fish/vendor_completions.d
|
|
||||||
$out/bin/aiken completion fish > $out/share/fish/vendor_completions.d/aiken.fish
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with pkgs.lib; {
|
meta = with pkgs.lib; {
|
||||||
description = "Cardano smart contract language and toolchain";
|
description = "Cardano smart contract language and toolchain";
|
||||||
homepage = "https://github.com/aiken-lang/aiken";
|
homepage = "https://github.com/aiken-lang/aiken";
|
||||||
|
@ -51,24 +43,32 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
commonCategory = y: builtins.map (x: x // { category = y; });
|
||||||
|
|
||||||
packages = {
|
packages = {
|
||||||
aiken = aiken;
|
aiken = aiken;
|
||||||
default = packages.aiken;
|
default = packages.aiken;
|
||||||
};
|
};
|
||||||
|
|
||||||
overlays.default = final: prev: { aiken = packages.aiken; };
|
aikenCmds = commonCategory "Aiken Development" [{
|
||||||
|
name = "aiken";
|
||||||
|
help = "Aiken toolchain";
|
||||||
|
package = packages.aiken;
|
||||||
|
}];
|
||||||
|
|
||||||
gitRev = if (builtins.hasAttr "rev" self) then self.rev else "dirty";
|
gitRev = if (builtins.hasAttr "rev" self) then self.rev else "dirty";
|
||||||
in {
|
in {
|
||||||
inherit packages overlays;
|
inherit packages;
|
||||||
|
|
||||||
devShell = pkgs.mkShell {
|
devShells.aiken = pkgs.mkShell {
|
||||||
buildInputs = with pkgs;
|
name = "aiken";
|
||||||
[
|
motd = ''
|
||||||
pkg-config
|
Aiken
|
||||||
openssl
|
$(type -p menu &>/dev/null && menu)'';
|
||||||
|
commands = aikenCmds;
|
||||||
|
|
||||||
cargo-insta
|
packages = [
|
||||||
|
deno
|
||||||
|
|
||||||
(pkgs.rust-bin.stable.latest.default.override {
|
(pkgs.rust-bin.stable.latest.default.override {
|
||||||
extensions = [ "rust-src" "clippy" "rustfmt" ];
|
extensions = [ "rust-src" "clippy" "rustfmt" ];
|
||||||
|
|
Loading…
Reference in New Issue