Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storewolf: declare dependencies on model and defaults files #1319

Merged
merged 1 commit into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sources/api/storewolf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions sources/api/storewolf/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}

Expand Down Expand Up @@ -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(),
Expand Down