BlueGit

ict rusty-teams

Files

rusty-teams / crates / app / build.rs

build.rs

Initial commit
metis Daniel Däschle · pushed by metis · 7 weeks ago
06e0ae51 History
build.rs 898 B Download Raw
1use std::process::Command;
2
3fn main() {
4 let commit = Command::new("git")
5 .args(["rev-parse", "--short", "HEAD"])
6 .output()
7 .ok()
8 .filter(|output| output.status.success())
9 .map(|output| String::from_utf8_lossy(&output.stdout).trim().to_owned())
10 .unwrap_or_else(|| "unknown".to_owned());
11 let timestamp = chrono::Utc::now().format("%Y%m%dT%H%M%SZ");
12 println!("cargo:rustc-env=TEAMS_BUILD_VERSION={commit}-{timestamp}");
13 if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") {
14 println!("cargo:rerun-if-changed=assets/icon/teams-fast.ico");
15 println!("cargo:rerun-if-changed=assets/icon/app.rc");
16 embed_resource::compile("assets/icon/app.rc", embed_resource::NONE)
17 .manifest_optional()
18 .unwrap();
19 }
20 println!("cargo:rerun-if-changed=always-rerun-for-fresh-timestamp");
21}