From c5d2e4d863db3d506b855ac8d781a2ad143a7122 Mon Sep 17 00:00:00 2001 From: baoyachi Date: Sun, 22 Aug 2021 16:35:12 +0800 Subject: [PATCH] fix env changed rerun --- src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 637ad81..40d9ce8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 @@ -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);