Add build commit hash to eww --version

This commit is contained in:
elkowar 2022-08-29 13:29:38 +02:00
parent 3c57ca59bf
commit eba1c032ae
No known key found for this signature in database
GPG key ID: E321AD71B1D1F27F

16
crates/eww/build.rs Normal file
View file

@ -0,0 +1,16 @@
use std::process::Command;
fn main() {
let output = Command::new("git").args(&["rev-parse", "HEAD"]).output();
if let Ok(output) = output {
if let Ok(hash) = String::from_utf8(output.stdout) {
println!("cargo:rustc-env=GIT_HASH={}", hash);
println!("cargo:rustc-env=CARGO_PKG_VERSION={} {}", env!("CARGO_PKG_VERSION"), hash);
}
}
let output = Command::new("git").args(&["show", "-s", "--format=%ci"]).output();
if let Ok(output) = output {
if let Ok(date) = String::from_utf8(output.stdout) {
println!("cargo:rustc-env=GIT_COMMIT_DATE={}", date);
}
}
}