use std::env;
use std::process::Command;
fn main() {
println!("cargo:rerun-if-changed=Cargo.toml");
// Print the current version from Cargo.toml
let version = env::var("CARGO_PKG_VERSION").unwrap();
println!("cargo:rustc-env=CARGO_PKG_VERSION={}", version);
// Optional: Print git commit hash
if let Ok(output) = Command::new("git").args(&["rev-parse", "HEAD"]).output() {
if output.status.success() {
let git_hash = String::from_utf8_lossy(&output.stdout);
println!("cargo:rustc-env=GIT_HASH={}", git_hash.trim());
}
}
}