17 lines
551 B
Rust
17 lines
551 B
Rust
use std::process::Command;
|
|
use chrono::Local;
|
|
|
|
fn main() {
|
|
let now = Local::now();
|
|
let build_date = now.format("%Y.%m.%d").to_string();
|
|
println!("cargo:rustc-env=BUILD_DATE={}", build_date);
|
|
|
|
if let Ok(output) = Command::new("git").args(&["rev-parse", "--short", "HEAD"]).output() {
|
|
if let Ok(hash) = String::from_utf8(output.stdout) {
|
|
println!("cargo:rustc-env=GIT_HASH={}", hash.trim());
|
|
}
|
|
}
|
|
println!("cargo:rerun-if-changed=../.git/HEAD");
|
|
println!("cargo:rerun-if-changed=../.git/index");
|
|
}
|