mirror of
https://github.com/CodeZeno/Claude-Code-Usage-Monitor.git
synced 2026-06-20 10:19:27 +08:00
28 lines
969 B
Rust
28 lines
969 B
Rust
fn main() {
|
|
// Derive version from the latest Git tag (e.g. "v1.0.7" → "1.0.7").
|
|
let version = std::process::Command::new("git")
|
|
.args(["describe", "--tags", "--abbrev=0"])
|
|
.output()
|
|
.ok()
|
|
.and_then(|o| {
|
|
if o.status.success() {
|
|
String::from_utf8(o.stdout).ok()
|
|
} else {
|
|
None
|
|
}
|
|
})
|
|
.unwrap_or_else(|| String::from("0.0.0"));
|
|
|
|
let version = version.trim().trim_start_matches('v');
|
|
println!("cargo:rustc-env=APP_VERSION={version}");
|
|
|
|
// Re-run build script whenever HEAD or tags change so the version stays current.
|
|
println!("cargo:rerun-if-changed=.git/HEAD");
|
|
println!("cargo:rerun-if-changed=.git/refs/tags");
|
|
|
|
// Embed the application icon into the executable.
|
|
let mut res = winres::WindowsResource::new();
|
|
res.set_icon("src/icons/icon.ico");
|
|
res.compile().expect("Failed to compile Windows resources");
|
|
}
|