garbage/build.rs

16 lines
347 B
Rust
Raw Permalink Normal View History

use std::process::Command;
fn get_git_hash() -> Option<String> {
let output = Command::new("git")
.args(&["rev-parse", "--short", "HEAD"])
.output()
.ok()?;
String::from_utf8(output.stdout).ok()
}
fn main() {
if let Some(hash) = get_git_hash() {
println!("cargo:rustc-env=GIT_HASH={}", hash);
}
}