display the git revision version information (#105)

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
Cyrill Leutwiler
2024-10-30 14:28:00 +01:00
committed by GitHub
parent 36d9317831
commit 68564f9866
2 changed files with 12 additions and 2 deletions
+9
View File
@@ -0,0 +1,9 @@
fn main() {
let git_rev = std::process::Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output()
.map(|out| String::from_utf8(out.stdout).unwrap_or_default())
.unwrap_or("unknown".to_owned());
println!("cargo:rustc-env=GIT_COMMIT_HASH={}", git_rev.trim());
}