Files
WhispAssist/src-tauri/build.rs
T

19 lines
791 B
Rust

fn main() {
// Bake the short commit hash in for the About page. Falls back to "unknown"
// in a non-git build (e.g. a source tarball). `logs/HEAD` is the reflog — it
// gets a line on every commit/checkout, so watching it re-runs this script
// when the hash changes (build.rs output is otherwise cached).
let hash = std::process::Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output()
.ok()
.filter(|o| o.status.success())
.map(|o| String::from_utf8_lossy(&o.stdout).trim().to_string())
.filter(|s| !s.is_empty())
.unwrap_or_else(|| "unknown".to_string());
println!("cargo:rustc-env=WA_GIT_HASH={hash}");
println!("cargo:rerun-if-changed=../.git/logs/HEAD");
tauri_build::build();
}