Files
ObsiGate/desktop/build.rs
T
bruno bab272bb5c
CI / lint (push) Successful in 2m45s
CI / security (push) Successful in 1m59s
CI / test (push) Successful in 4m44s
CI / build (push) Successful in 1m52s
CI / e2e (push) Successful in 16m16s
fix: desktop — commandes Tauri bloquées par l'ACL et crash heap à l'ouverture (BUG-104, BUG-105)
2026-10-02 20:17:20 -04:00

45 lines
1.7 KiB
Rust

fn main() {
// Version livrée : `VERSION` (racine du dépôt) est la source unique de
// vérité (même fichier que backend/version.py et l'image Docker).
// Repli : `git describe` quand le fichier n'est pas dans le contexte de build.
let version = std::fs::read_to_string(
std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../VERSION"),
)
.ok()
.map(|s| s.trim().to_string())
.filter(|s| !s.is_empty())
.unwrap_or_else(|| {
std::process::Command::new("git")
.args(["describe", "--tags", "--dirty=-dirty"])
.output()
.ok()
.and_then(|o| String::from_utf8(o.stdout).ok())
.map(|s| s.trim().trim_start_matches('v').to_string())
.unwrap_or_else(|| "0.0.0".to_string())
});
// Extract short hash for display
let short_hash = std::process::Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output()
.ok()
.and_then(|o| String::from_utf8(o.stdout).ok())
.map(|s| s.trim().to_string())
.unwrap_or_else(|| "unknown".to_string());
// SemVer base (strip -suffix)
let semver_base = version.split('-').next().unwrap_or("0.0.0");
println!("cargo:rustc-env=GIT_VERSION={}", version);
println!("cargo:rustc-env=GIT_HASH={}", short_hash);
println!("cargo:rustc-env=SEMVER={}", semver_base);
println!("cargo:rerun-if-changed=../VERSION");
println!("cargo:rerun-if-changed=.git/HEAD");
println!("cargo:rerun-if-changed=.git/refs/heads/main");
println!("cargo:rerun-if-changed=.git/refs/tags");
println!("cargo:rerun-if-changed=permissions");
tauri_build::build()
}