Move compile-time build info to aiken-project

So that we can use it as part of the blueprints.
This commit is contained in:
KtorZ
2023-10-06 14:08:47 +02:00
parent bd61a2ddf3
commit d56d5180cf
8 changed files with 40 additions and 48 deletions

View File

@@ -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"] }

View File

@@ -0,0 +1,3 @@
fn main() {
built::write_built_file().expect("Failed to acquire build-time information");
}

View File

@@ -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,)
}
}