app
service-kicad
Public Made by Adomby adom
Shared headless KiCad 10: DRC, ERC, SVG/Gerber/STEP export, Altium library conversion, symbol/footprint/3D-model lookup. Every Adom tool shells to this CLI instead of calling the HTTP API directly.
//! Bake the git SHA of HEAD into the binary at compile time, surfaced
//! as `git_sha` in /health. Compile-time (not runtime `git -C` like
//! service-step2glb) because the deployed binary can outlive the repo
//! checkout it was built from — the watchdog resets the repo *then*
//! rebuilds, and a failed rebuild keeps the old binary running.
use std::process::Command;
fn main() {
let sha = Command::new("git")
.args(["rev-parse", "HEAD"])
.output()
.ok()
.filter(|o| o.status.success())
.and_then(|o| String::from_utf8(o.stdout).ok())
.map(|s| s.trim().to_string())
.unwrap_or_else(|| "unknown".into());
println!("cargo:rustc-env=GIT_SHA={sha}");
// Recompile when HEAD moves even if no source file changed
// (e.g. a docs- or cli-only commit) so the SHA can't go stale.
println!("cargo:rerun-if-changed=../.git/HEAD");
println!("cargo:rerun-if-changed=../.git/refs/heads/main");
}