Add build commit hash to eww --version
This commit is contained in:
parent
3c57ca59bf
commit
eba1c032ae
1 changed files with 16 additions and 0 deletions
16
crates/eww/build.rs
Normal file
16
crates/eww/build.rs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue