Move compile-time build info to aiken-project
So that we can use it as part of the blueprints.
This commit is contained in:
parent
bd61a2ddf3
commit
d56d5180cf
|
@ -57,7 +57,6 @@ dependencies = [
|
||||||
"aiken-lsp",
|
"aiken-lsp",
|
||||||
"aiken-project",
|
"aiken-project",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"built",
|
|
||||||
"clap",
|
"clap",
|
||||||
"clap_complete",
|
"clap_complete",
|
||||||
"hex",
|
"hex",
|
||||||
|
@ -129,6 +128,7 @@ dependencies = [
|
||||||
"aiken-lang",
|
"aiken-lang",
|
||||||
"askama",
|
"askama",
|
||||||
"assert-json-diff",
|
"assert-json-diff",
|
||||||
|
"built",
|
||||||
"dirs",
|
"dirs",
|
||||||
"fslock",
|
"fslock",
|
||||||
"futures",
|
"futures",
|
||||||
|
@ -153,7 +153,7 @@ dependencies = [
|
||||||
"strip-ansi-escapes",
|
"strip-ansi-escapes",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
"toml 0.7.3",
|
"toml",
|
||||||
"uplc",
|
"uplc",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
"zip",
|
"zip",
|
||||||
|
@ -378,9 +378,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "built"
|
name = "built"
|
||||||
version = "0.6.0"
|
version = "0.6.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "96f9cdd34d6eb553f9ea20e5bf84abb7b13c729f113fc1d8e49dc00ad9fa8738"
|
checksum = "b99c4cdc7b2c2364182331055623bdf45254fcb679fea565c40c3c11c101889a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-lock",
|
"cargo-lock",
|
||||||
"git2",
|
"git2",
|
||||||
|
@ -427,13 +427,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cargo-lock"
|
name = "cargo-lock"
|
||||||
version = "8.0.3"
|
version = "9.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "031718ddb8f78aa5def78a09e90defe30151d1f6c672f937af4dd916429ed996"
|
checksum = "e11c675378efb449ed3ce8de78d75d0d80542fc98487c26aba28eb3b82feac72"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"semver",
|
"semver",
|
||||||
"serde",
|
"serde",
|
||||||
"toml 0.5.11",
|
"toml",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1035,9 +1035,9 @@ checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "git2"
|
name = "git2"
|
||||||
version = "0.16.1"
|
version = "0.17.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ccf7f68c2995f392c49fffb4f95ae2c873297830eb25c6bc4c114ce8f4562acc"
|
checksum = "7b989d6a7ca95a362cf2cfc5ad688b3a467be1f87e480b8dad07fee8c79b0044"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"libc",
|
"libc",
|
||||||
|
@ -1407,9 +1407,9 @@ checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libgit2-sys"
|
name = "libgit2-sys"
|
||||||
version = "0.14.2+1.5.1"
|
version = "0.15.2+1.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7f3d95f6b51075fe9810a7ae22c7095f12b98005ab364d8544797a825ce946a4"
|
checksum = "a80df2e11fb4a61f4ba2ab42dbe7f74468da143f1a75c74e11dee7c813f694fa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
|
@ -1425,9 +1425,9 @@ checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libz-sys"
|
name = "libz-sys"
|
||||||
version = "1.1.9"
|
version = "1.1.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db"
|
checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
|
@ -2375,9 +2375,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "semver"
|
name = "semver"
|
||||||
version = "1.0.17"
|
version = "1.0.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
|
checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
@ -2827,15 +2827,6 @@ dependencies = [
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml"
|
|
||||||
version = "0.5.11"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "0.7.3"
|
version = "0.7.3"
|
||||||
|
|
|
@ -12,6 +12,7 @@ authors = [
|
||||||
"KtorZ <matthias.benkort@gmail.com>",
|
"KtorZ <matthias.benkort@gmail.com>",
|
||||||
]
|
]
|
||||||
rust-version = "1.66.1"
|
rust-version = "1.66.1"
|
||||||
|
build = "build.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
askama = "0.12.0"
|
askama = "0.12.0"
|
||||||
|
@ -48,3 +49,6 @@ uplc = { path = '../uplc', version = "1.0.19-alpha" }
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
proptest = "1.2.0"
|
proptest = "1.2.0"
|
||||||
pretty_assertions = "1.3.0"
|
pretty_assertions = "1.3.0"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
built = { version = "0.6.0", features = ["git2"] }
|
||||||
|
|
|
@ -116,3 +116,19 @@ impl Config {
|
||||||
Some(self)
|
Some(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod built_info {
|
||||||
|
include!(concat!(env!("OUT_DIR"), "/built.rs"));
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn compiler_version(include_commit_hash: bool) -> String {
|
||||||
|
if include_commit_hash {
|
||||||
|
format!(
|
||||||
|
"v{} {}",
|
||||||
|
built_info::PKG_VERSION_MAJOR,
|
||||||
|
built_info::GIT_COMMIT_HASH_SHORT.unwrap_or("unknown")
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
format!("v{}", built_info::PKG_VERSION_MAJOR,)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ authors = [
|
||||||
"KtorZ <matthias.benkort@gmail.com>",
|
"KtorZ <matthias.benkort@gmail.com>",
|
||||||
]
|
]
|
||||||
rust-version = "1.66.1"
|
rust-version = "1.66.1"
|
||||||
build = "build.rs"
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.69"
|
anyhow = "1.0.69"
|
||||||
|
@ -44,6 +43,3 @@ clap_complete = "4.3.2"
|
||||||
inquire = "0.6.2"
|
inquire = "0.6.2"
|
||||||
num-bigint = "0.4.3"
|
num-bigint = "0.4.3"
|
||||||
ordinal = "0.3.2"
|
ordinal = "0.3.2"
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
built = { version = "0.6.0", features = ["git2"] }
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use aiken_project::config;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|
||||||
pub mod blueprint;
|
pub mod blueprint;
|
||||||
|
@ -12,11 +13,9 @@ 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
|
/// Aiken: a smart-contract language and toolchain for Cardano
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[clap(version = version(), about, long_about = None)]
|
#[clap(version = config::compiler_version(true), about, long_about = None)]
|
||||||
#[clap(propagate_version = true)]
|
#[clap(propagate_version = true)]
|
||||||
pub enum Cmd {
|
pub enum Cmd {
|
||||||
New(new::Args),
|
New(new::Args),
|
||||||
|
@ -51,11 +50,3 @@ impl Default for Cmd {
|
||||||
Self::parse()
|
Self::parse()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn version() -> String {
|
|
||||||
format!(
|
|
||||||
"v{} {}",
|
|
||||||
built_info::PKG_VERSION,
|
|
||||||
built_info::GIT_COMMIT_HASH_SHORT.unwrap_or("unknown")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use aiken_project::{
|
use aiken_project::{
|
||||||
config::Config,
|
config::{self, Config},
|
||||||
package_name::{self, PackageName},
|
package_name::{self, PackageName},
|
||||||
};
|
};
|
||||||
use indoc::{formatdoc, indoc};
|
use indoc::{formatdoc, indoc};
|
||||||
|
@ -11,8 +11,6 @@ use std::{
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::built_info;
|
|
||||||
|
|
||||||
#[derive(clap::Args)]
|
#[derive(clap::Args)]
|
||||||
/// Create a new Aiken project
|
/// Create a new Aiken project
|
||||||
pub struct Args {
|
pub struct Args {
|
||||||
|
@ -196,13 +194,13 @@ fn create_github_action(root: &Path) -> miette::Result<()> {
|
||||||
|
|
||||||
- uses: aiken-lang/setup-aiken@v0.1.0
|
- uses: aiken-lang/setup-aiken@v0.1.0
|
||||||
with:
|
with:
|
||||||
version: v{version}
|
version: {version}
|
||||||
|
|
||||||
- run: aiken fmt --check
|
- run: aiken fmt --check
|
||||||
- run: aiken check -D
|
- run: aiken check -D
|
||||||
- run: aiken build
|
- run: aiken build
|
||||||
"#,
|
"#,
|
||||||
version = built_info::PKG_VERSION,
|
version = config::compiler_version(false),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.into_diagnostic()?;
|
.into_diagnostic()?;
|
||||||
|
|
|
@ -14,10 +14,6 @@ use uplc::machine::cost_model::ExBudget;
|
||||||
|
|
||||||
pub mod cmd;
|
pub mod cmd;
|
||||||
|
|
||||||
pub mod built_info {
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/built.rs"));
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn with_project<A>(directory: Option<PathBuf>, deny: bool, mut action: A) -> miette::Result<()>
|
pub fn with_project<A>(directory: Option<PathBuf>, deny: bool, mut action: A) -> miette::Result<()>
|
||||||
where
|
where
|
||||||
A: FnMut(&mut Project<Terminal>) -> Result<(), Vec<aiken_project::error::Error>>,
|
A: FnMut(&mut Project<Terminal>) -> Result<(), Vec<aiken_project::error::Error>>,
|
||||||
|
|
Loading…
Reference in New Issue