use std::process::Command;
fn main() {
let version = Command::new("git")
.args(["describe", "--tags", "--always", "--dirty"])
.output()
.ok()
.filter(|output| output.status.success())
.and_then(|output| String::from_utf8(output.stdout).ok())
.map(|s| s.trim().to_string())
.filter(|s| !s.is_empty())
.map(|s| s.strip_prefix('v').unwrap_or(&s).to_string())
.unwrap_or_else(|| env!("CARGO_PKG_VERSION").to_string());
println!("cargo:rustc-env=GWX_VERSION={version}");
println!("cargo:rerun-if-changed=.git/HEAD");
println!("cargo:rerun-if-changed=.git/refs");
}