use std::process::Command;
fn main() {
include_packed::Config::new("assets")
.level(19)
.build()
.expect("pack assets");
let git_full = Command::new("git")
.args(["rev-parse", "HEAD"])
.output()
.ok()
.and_then(|o| if o.status.success() { String::from_utf8(o.stdout).ok() } else { None })
.map(|s| s.trim().to_string())
.unwrap_or_else(|| "unknown".to_string());
let git_short = git_full.chars().take(10).collect::<String>();
println!("cargo:rustc-env=GIT_COMMIT={}", git_full);
println!("cargo:rustc-env=GIT_COMMIT_SHORT={}", git_short);
let ts = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.map(|d| d.as_secs())
.unwrap_or(0);
println!("cargo:rustc-env=BUILD_TIMESTAMP={}", ts);
println!("cargo:rerun-if-changed=.git/HEAD");
println!("cargo:rerun-if-changed=.git/refs/heads");
}