-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
33 lines (33 loc) · 1.24 KB
/
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
28
29
30
31
32
33
fn main() {
// If we set CARGO_PKG_VERSION this way, then it will override the default value, which is
// taken from the `version` in Cargo.toml.
if let Ok(val) = std::env::var("VERSION") {
println!("cargo:rustc-env=CARGO_PKG_VERSION={}", val);
}
println!("cargo:rerun-if-env-changed=VERSION");
// Set other build flags...
if let Ok(val) = std::env::var("REV") {
println!("cargo:rustc-env=REV={}", val);
} else {
println!("cargo:rustc-env=REV={}", "");
}
println!("cargo:rerun-if-env-changed=REV");
if let Ok(val) = std::env::var("BRANCH") {
println!("cargo:rustc-env=BRANCH={}", val);
} else {
println!("cargo:rustc-env=BRANCH={}", "");
}
println!("cargo:rerun-if-env-changed=BRANCH");
if let Ok(val) = std::env::var("BUILD_USER") {
println!("cargo:rustc-env=BUILD_USER={}", val);
} else {
println!("cargo:rustc-env=BUILD_USER={}", "");
}
println!("cargo:rerun-if-env-changed=BUILD_USER");
if let Ok(val) = std::env::var("RUST_VERSION") {
println!("cargo:rustc-env=RUST_VERSION={}", val);
} else {
println!("cargo:rustc-env=RUST_VERSION={}", "");
}
println!("cargo:rerun-if-env-changed=RUST_VERSION");
}