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-project",
|
||||
"anyhow",
|
||||
"built",
|
||||
"clap",
|
||||
"clap_complete",
|
||||
"hex",
|
||||
|
@ -129,6 +128,7 @@ dependencies = [
|
|||
"aiken-lang",
|
||||
"askama",
|
||||
"assert-json-diff",
|
||||
"built",
|
||||
"dirs",
|
||||
"fslock",
|
||||
"futures",
|
||||
|
@ -153,7 +153,7 @@ dependencies = [
|
|||
"strip-ansi-escapes",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"toml 0.7.3",
|
||||
"toml",
|
||||
"uplc",
|
||||
"walkdir",
|
||||
"zip",
|
||||
|
@ -378,9 +378,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "built"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96f9cdd34d6eb553f9ea20e5bf84abb7b13c729f113fc1d8e49dc00ad9fa8738"
|
||||
checksum = "b99c4cdc7b2c2364182331055623bdf45254fcb679fea565c40c3c11c101889a"
|
||||
dependencies = [
|
||||
"cargo-lock",
|
||||
"git2",
|
||||
|
@ -427,13 +427,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cargo-lock"
|
||||
version = "8.0.3"
|
||||
version = "9.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "031718ddb8f78aa5def78a09e90defe30151d1f6c672f937af4dd916429ed996"
|
||||
checksum = "e11c675378efb449ed3ce8de78d75d0d80542fc98487c26aba28eb3b82feac72"
|
||||
dependencies = [
|
||||
"semver",
|
||||
"serde",
|
||||
"toml 0.5.11",
|
||||
"toml",
|
||||
"url",
|
||||
]
|
||||
|
||||
|
@ -1035,9 +1035,9 @@ checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4"
|
|||
|
||||
[[package]]
|
||||
name = "git2"
|
||||
version = "0.16.1"
|
||||
version = "0.17.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccf7f68c2995f392c49fffb4f95ae2c873297830eb25c6bc4c114ce8f4562acc"
|
||||
checksum = "7b989d6a7ca95a362cf2cfc5ad688b3a467be1f87e480b8dad07fee8c79b0044"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"libc",
|
||||
|
@ -1407,9 +1407,9 @@ checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5"
|
|||
|
||||
[[package]]
|
||||
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"
|
||||
checksum = "7f3d95f6b51075fe9810a7ae22c7095f12b98005ab364d8544797a825ce946a4"
|
||||
checksum = "a80df2e11fb4a61f4ba2ab42dbe7f74468da143f1a75c74e11dee7c813f694fa"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
|
@ -1425,9 +1425,9 @@ checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb"
|
|||
|
||||
[[package]]
|
||||
name = "libz-sys"
|
||||
version = "1.1.9"
|
||||
version = "1.1.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db"
|
||||
checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
|
@ -2375,9 +2375,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.17"
|
||||
version = "1.0.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
|
||||
checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
@ -2827,15 +2827,6 @@ dependencies = [
|
|||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.7.3"
|
||||
|
|
|
@ -12,6 +12,7 @@ authors = [
|
|||
"KtorZ <matthias.benkort@gmail.com>",
|
||||
]
|
||||
rust-version = "1.66.1"
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
askama = "0.12.0"
|
||||
|
@ -48,3 +49,6 @@ uplc = { path = '../uplc', version = "1.0.19-alpha" }
|
|||
[dev-dependencies]
|
||||
proptest = "1.2.0"
|
||||
pretty_assertions = "1.3.0"
|
||||
|
||||
[build-dependencies]
|
||||
built = { version = "0.6.0", features = ["git2"] }
|
||||
|
|
|
@ -116,3 +116,19 @@ impl Config {
|
|||
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>",
|
||||
]
|
||||
rust-version = "1.66.1"
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.69"
|
||||
|
@ -44,6 +43,3 @@ clap_complete = "4.3.2"
|
|||
inquire = "0.6.2"
|
||||
num-bigint = "0.4.3"
|
||||
ordinal = "0.3.2"
|
||||
|
||||
[build-dependencies]
|
||||
built = { version = "0.6.0", features = ["git2"] }
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use aiken_project::config;
|
||||
use clap::Parser;
|
||||
|
||||
pub mod blueprint;
|
||||
|
@ -12,11 +13,9 @@ pub mod packages;
|
|||
pub mod tx;
|
||||
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(version = config::compiler_version(true), about, long_about = None)]
|
||||
#[clap(propagate_version = true)]
|
||||
pub enum Cmd {
|
||||
New(new::Args),
|
||||
|
@ -51,11 +50,3 @@ impl Default for Cmd {
|
|||
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::{
|
||||
config::Config,
|
||||
config::{self, Config},
|
||||
package_name::{self, PackageName},
|
||||
};
|
||||
use indoc::{formatdoc, indoc};
|
||||
|
@ -11,8 +11,6 @@ use std::{
|
|||
str::FromStr,
|
||||
};
|
||||
|
||||
use crate::built_info;
|
||||
|
||||
#[derive(clap::Args)]
|
||||
/// Create a new Aiken project
|
||||
pub struct Args {
|
||||
|
@ -196,13 +194,13 @@ fn create_github_action(root: &Path) -> miette::Result<()> {
|
|||
|
||||
- uses: aiken-lang/setup-aiken@v0.1.0
|
||||
with:
|
||||
version: v{version}
|
||||
version: {version}
|
||||
|
||||
- run: aiken fmt --check
|
||||
- run: aiken check -D
|
||||
- run: aiken build
|
||||
"#,
|
||||
version = built_info::PKG_VERSION,
|
||||
version = config::compiler_version(false),
|
||||
},
|
||||
)
|
||||
.into_diagnostic()?;
|
||||
|
|
|
@ -14,10 +14,6 @@ use uplc::machine::cost_model::ExBudget;
|
|||
|
||||
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<()>
|
||||
where
|
||||
A: FnMut(&mut Project<Terminal>) -> Result<(), Vec<aiken_project::error::Error>>,
|
||||
|
|
Loading…
Reference in New Issue