1 use std::process::Command;
2
3 fn main() {
4 // Capture the build date so the interface can show which build is running.
5 // With no rerun-if-changed pin, Cargo re-runs this whenever the crate's
6 // sources change, so CCE_BUILD_DATE tracks the last actual recompile.
7 let date = Command::new("date")
8 .arg("+%Y-%m-%d")
9 .output()
10 .ok()
11 .and_then(|o| String::from_utf8(o.stdout).ok())
12 .map(|s| s.trim().to_string())
13 .filter(|s| !s.is_empty())
14 .unwrap_or_else(|| "unknown".to_string());
15 println!("cargo:rustc-env=CCE_BUILD_DATE={}", date);
16 }