11 lines
376 B
Rust
11 lines
376 B
Rust
fn main() {
|
|
// Embed git commit hash at build time
|
|
let output = std::process::Command::new("git")
|
|
.args(["log", "-1", "--format=%h"])
|
|
.output();
|
|
let commit = match output {
|
|
Ok(o) => String::from_utf8_lossy(&o.stdout).trim().to_string(),
|
|
Err(_) => "unknown".to_string(),
|
|
};
|
|
println!("cargo:rustc-env=GIT_COMMIT={commit}");
|
|
}
|