//! The build's identity, for the version it reports: `OXY_BUILD` when a release or //! an install sets it (from `oxy describe`), else the heads a Flow job is //! building, else "local build". fn main() { println!("cargo:rerun-if-env-changed=OXY_BUILD"); println!("cargo:rerun-if-env-changed=FLOW_HEADS"); let build = std::env::var("OXY_BUILD") .ok() .map(|b| b.trim().to_string()) .filter(|b| !b.is_empty()) .or_else(|| { std::env::var("FLOW_HEADS") .ok() .and_then(|h| h.split('+').next().map(|x| format!("flow #{}", &x[..12.min(x.len())]))) .filter(|b| b.len() > "flow #".len()) }) .unwrap_or_else(|| "local build".into()); println!("cargo:rustc-env=OXY_BUILD_ID={build}"); println!("cargo:rustc-env=OXY_VERSION_LONG={} ({build})", std::env::var("CARGO_PKG_VERSION").unwrap()); }