blob: 014960f4ff274dd0f55faeb953bb9444420ebc72 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
use std::process::Command;
fn main() {
println!("cargo:rerun-if-env-changed=TYPST_VERSION");
if option_env!("TYPST_VERSION").is_some() {
return;
}
let pkg = env!("CARGO_PKG_VERSION");
let hash = Command::new("git")
.args(["rev-parse", "HEAD"])
.output()
.ok()
.filter(|output| output.status.success())
.and_then(|output| String::from_utf8(output.stdout.get(..8)?.into()).ok())
.unwrap_or_else(|| "(unknown hash)".into());
println!("cargo:rustc-env=TYPST_VERSION={pkg} ({hash})");
}
|