forked from PolymeshAssociation/Polymesh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
27 lines (20 loc) · 755 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use std::{env, path::PathBuf};
use vergen::{generate_cargo_keys, ConstantsFlags};
const ERROR_MSG: &str = "Failed to generate metadata files";
fn main() {
generate_cargo_keys(ConstantsFlags::SHA_SHORT).expect(ERROR_MSG);
let mut manifest_dir = PathBuf::from(
env::var("CARGO_MANIFEST_DIR").expect("`CARGO_MANIFEST_DIR` is always set by cargo."),
);
while manifest_dir.parent().is_some() {
if manifest_dir.join(".git/HEAD").exists() {
println!(
"cargo:rerun-if-changed={}",
manifest_dir.join(".git/HEAD").display()
);
return;
}
manifest_dir.pop();
}
println!("cargo:warning=Could not find `.git/HEAD` from manifest dir!");
}