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

Rebuild test-runtime if substrate binary is updated #362

Merged
merged 3 commits into from
Dec 10, 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
1 change: 1 addition & 0 deletions test-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ codec = { package = "parity-scale-codec", version = "2", default-features = fals
subxt = { path = ".." }
sp-core = { package = "sp-core", git = "https://github.com/paritytech/substrate/", branch = "master" }
async-std = { version = "1.9.0", features = ["attributes", "tokio1"] }
which = "4.2.2"
8 changes: 8 additions & 0 deletions test-runtime/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ async fn run() {
fs::write(&runtime_path, runtime_api_contents)
.expect("Couldn't write runtime rust output");

let substrate_path =
which::which(substrate_bin).expect("Cannot resolve path to substrate binary");

// Re-build if the substrate binary we're pointed to changes (mtime):
println!(
"cargo:rerun-if-changed={}",
substrate_path.to_string_lossy()
);
// Re-build if we point to a different substrate binary:
println!("cargo:rerun-if-env-changed={}", SUBSTRATE_BIN_ENV_VAR);
// Re-build if this file changes:
Expand Down