mirror of
https://github.com/jht5945/buildj.git
synced 2025-12-29 02:10:04 +08:00
add git hash
This commit is contained in:
7
build.rs
Normal file
7
build.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
use std::process::Command;
|
||||
fn main() {
|
||||
// note: add error checking yourself.
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user