Skip to content

Commit

Permalink
fix env changed rerun
Browse files Browse the repository at this point in the history
  • Loading branch information
baoyachi committed Aug 22, 2021
1 parent ecb8d2c commit c5d2e4d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ impl Shadow {
fn write_all(&mut self) -> SdResult<()> {
self.gen_header()?;

//std env rerun
self.cargo_rerun_if_env_changed();

self.gen_const()?;

//write version function
Expand All @@ -345,6 +348,12 @@ impl Shadow {
Ok(())
}

fn cargo_rerun_if_env_changed(&self) {
for k in self.std_env.keys() {
println!("cargo:rerun-if-env-changed={}", k);
}
}

fn gen_const(&mut self) -> SdResult<()> {
for (k, v) in self.map.clone() {
println!("cargo:rerun-if-env-changed={}", k);
Expand Down

0 comments on commit c5d2e4d

Please sign in to comment.