16 lines
345 B
Rust
16 lines
345 B
Rust
use std::process::Command;
|
|
|
|
fn hash() {
|
|
let output = Command::new("git")
|
|
.args(["rev-parse", "HEAD"])
|
|
.output()
|
|
.unwrap();
|
|
let git_hash = String::from_utf8(output.stdout).unwrap();
|
|
println!("cargo:rustc-env=GIT_HASH={git_hash}");
|
|
println!("cargo:rerun-if-changed=.git/HEAD");
|
|
}
|
|
|
|
fn main() {
|
|
hash();
|
|
}
|