Use build.rs to properly trigger rebuilds when env vars change, for #44

This commit is contained in:
Magnus Hoff 2017-11-20 10:26:35 +01:00
parent 83b011b9c9
commit 8519480fe4
2 changed files with 12 additions and 0 deletions

View file

@ -45,4 +45,13 @@ fn main() {
for entry in WalkDir::new("migrations").into_iter().filter_map(|e| e.ok()) { for entry in WalkDir::new("migrations").into_iter().filter_map(|e| e.ok()) {
println!("cargo:rerun-if-changed={}", entry.path().display()); println!("cargo:rerun-if-changed={}", entry.path().display());
} }
// For build_config.rs
for env_var in &[
"CONTINUOUS_INTEGRATION",
"TRAVIS_BRANCH",
"TRAVIS_COMMIT",
] {
println!("cargo:rerun-if-env-changed={}", env_var);
}
} }

View file

@ -1,5 +1,8 @@
#![allow(dead_code)] #![allow(dead_code)]
// The non-CARGO env variables used here must be listed
// in build.rs to properly trigger rebuild on change
pub const PROJECT_NAME: &str = env!("CARGO_PKG_NAME"); pub const PROJECT_NAME: &str = env!("CARGO_PKG_NAME");
lazy_static! { lazy_static! {