From b4279dd8a1689625ad221555fb3c04de92179492 Mon Sep 17 00:00:00 2001 From: Tom Kirchner Date: Thu, 11 Feb 2021 21:11:21 +0000 Subject: [PATCH] storewolf: declare dependencies on model and defaults files Without this, you can change a defaults file and not haven those changes in a new build, or change the variant and still use the prior cached model link. --- sources/api/storewolf/Cargo.toml | 3 +++ sources/api/storewolf/build.rs | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/sources/api/storewolf/Cargo.toml b/sources/api/storewolf/Cargo.toml index 76ff2fbeedc..94809d90950 100644 --- a/sources/api/storewolf/Cargo.toml +++ b/sources/api/storewolf/Cargo.toml @@ -23,6 +23,9 @@ toml = "0.5" [build-dependencies] cargo-readme = "3.1" merge-toml = { path = "merge-toml" } +# model dep because we read default settings from the model directory; we also +# reflect it with cargo:rerun-if-changed statements in build.rs. +models = { path = "../../models" } snafu = "0.6" toml = "0.5" walkdir = "2" diff --git a/sources/api/storewolf/build.rs b/sources/api/storewolf/build.rs index 240cdd73e57..0b4dfe32a3c 100644 --- a/sources/api/storewolf/build.rs +++ b/sources/api/storewolf/build.rs @@ -23,6 +23,9 @@ fn main() -> Result<()> { generate_readme(); generate_defaults_toml()?; + // Reflect that we need to rerun if variant has changed to pick up the new default settings. + println!("cargo:rerun-if-env-changed=VARIANT"); + Ok(()) } @@ -68,6 +71,10 @@ fn generate_defaults_toml() -> Result<()> { let mut defaults = Value::Table(Map::new()); for entry in walker { let entry = entry.context(error::ListFiles { dir: DEFAULTS_DIR })?; + + // Reflect that we need to rerun if any of the default settings files have changed. + println!("cargo:rerun-if-changed={}", entry.path().display()); + let data = fs::read_to_string(entry.path()).context(error::File { op: "read", path: entry.path(),