Small changes

This commit is contained in:
Shiroyasha 2024-09-29 22:35:46 +03:00
parent 7196c719e2
commit 0526cc9412
Signed by: shiroyashik
GPG key ID: E4953D3940D7860A
8 changed files with 84 additions and 69 deletions

17
build.rs Normal file
View file

@ -0,0 +1,17 @@
use std::process::Command;
fn main() {
let output = match Command::new("git").args(&["rev-parse", "HEAD"]).output() {
Ok(d) => d,
Err(err) => {
eprintln!("Can't run git and get last commit due: {err:?}");
println!("cargo:rustc-env=GIT_HASH=0000000000000000000000000000000000000000");
return
}
};
let mut git_hash = String::from_utf8(output.stdout).unwrap();
if &git_hash == "HEAD" || git_hash.len() < 7 {
git_hash = String::from("0000000000000000000000000000000000000000");
}
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
}