From 55e6b4dcbc174fe9f01520cc5f233a90f36eeb1f Mon Sep 17 00:00:00 2001 From: James Wilson Date: Fri, 10 Dec 2021 11:02:53 +0000 Subject: [PATCH 1/3] Re-run test-runtime build script if the substrate binary changes --- test-runtime/Cargo.toml | 1 + test-runtime/build.rs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/test-runtime/Cargo.toml b/test-runtime/Cargo.toml index 0094dd13cd..3b10fbc37b 100644 --- a/test-runtime/Cargo.toml +++ b/test-runtime/Cargo.toml @@ -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" diff --git a/test-runtime/build.rs b/test-runtime/build.rs index e0b2c33ba4..3ae602c13e 100644 --- a/test-runtime/build.rs +++ b/test-runtime/build.rs @@ -113,6 +113,10 @@ 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("can 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: From e0a9804c083eb7cb39fbb1230f103d31f07a653a Mon Sep 17 00:00:00 2001 From: James Wilson Date: Fri, 10 Dec 2021 11:03:19 +0000 Subject: [PATCH 2/3] cargo fmt --- test-runtime/build.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test-runtime/build.rs b/test-runtime/build.rs index 3ae602c13e..ce06037937 100644 --- a/test-runtime/build.rs +++ b/test-runtime/build.rs @@ -113,10 +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("can resolve path to substrate binary"); + let substrate_path = + which::which(substrate_bin).expect("can 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()); + 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: From 8a3ff43e58b8f25bef97890988aa231ee7568f77 Mon Sep 17 00:00:00 2001 From: James Wilson Date: Fri, 10 Dec 2021 11:13:23 +0000 Subject: [PATCH 3/3] Can => Cannot --- test-runtime/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-runtime/build.rs b/test-runtime/build.rs index ce06037937..5b4da8c647 100644 --- a/test-runtime/build.rs +++ b/test-runtime/build.rs @@ -114,7 +114,7 @@ async fn run() { .expect("Couldn't write runtime rust output"); let substrate_path = - which::which(substrate_bin).expect("can resolve path to substrate binary"); + which::which(substrate_bin).expect("Cannot resolve path to substrate binary"); // Re-build if the substrate binary we're pointed to changes (mtime): println!(