2021-05-06 11:00:03 +00:00
|
|
|
// build.rs
|
|
|
|
use std::env;
|
|
|
|
use std::process::Command;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let repoid = match env::var("REPOID") {
|
|
|
|
Ok(repoid) => repoid,
|
2022-04-06 14:57:36 +00:00
|
|
|
Err(_) => match Command::new("git").args(&["rev-parse", "HEAD"]).output() {
|
|
|
|
Ok(output) => String::from_utf8(output.stdout).unwrap(),
|
|
|
|
Err(err) => {
|
|
|
|
panic!("git rev-parse failed: {}", err);
|
2021-05-06 11:00:03 +00:00
|
|
|
}
|
2022-04-06 14:57:36 +00:00
|
|
|
},
|
2021-05-06 11:00:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
println!("cargo:rustc-env=REPOID={}", repoid);
|
|
|
|
}
|