Alex Crichton 1c8061e675 Implement a version string
Add a `--version` and `-V` to the command to print out the version
2018-03-01 19:19:12 -08:00

15 lines
330 B
Rust

use std::process::Command;
fn main() {
let rev = Command::new("git")
.arg("rev-parse")
.arg("HEAD")
.output()
.ok()
.map(|s| s.stdout)
.and_then(|s| String::from_utf8(s).ok());
if let Some(rev) = rev {
println!("cargo:rustc-env=WBG_VERSION={}", &rev[..9]);
}
}