19 lines
520 B
Rust
19 lines
520 B
Rust
use std::process::Command;
|
|
|
|
fn main() {
|
|
println!("cargo:rerun-if-changed=.git/HEAD");
|
|
println!("cargo:rerun-if-changed=.git/refs");
|
|
|
|
if let Ok(output) = Command::new("git")
|
|
.args(["rev-parse", "--short=12", "HEAD"])
|
|
.output()
|
|
{
|
|
if output.status.success() {
|
|
let commit = String::from_utf8_lossy(&output.stdout).trim().to_string();
|
|
if !commit.is_empty() {
|
|
println!("cargo:rustc-env=BZOD_GIT_COMMIT={commit}");
|
|
}
|
|
}
|
|
}
|
|
}
|