use std::process::Command;
#[allow(unreachable_code, clippy::pedantic)]
fn main() -> Result<(), String> {
#[cfg(all(feature = "infer-backend", feature = "xdg-mime-backend"))]
return Err(String::from(
"fif cannot be compiled with multiple backends set - please enable only one, or use the default.",
));
let git = Command::new("git").args(["rev-parse", "--short", "HEAD"]).output();
let hash = match git {
Ok(output) => String::from_utf8_lossy(&output.stdout).into(),
Err(_) => {
println!("cargo:warning=Failed to retrieve git commit hash");
String::from("???")
}
};
println!("cargo:rustc-env=GIT_SHA={}", hash);
println!("cargo:rustc-rerun-if-changed=.git/HEAD");
Ok(())
}