mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 16:31:07 +00:00
Don't re-compile on every cargo run (#4019)
- Add new crate `substrate-build-script-utils` to unify the code of `node`, `node-template` and `polkadot-node`. - The `node-cli` build script needs to search upwards for the `.git/HEAD` file to find it.
This commit is contained in:
@@ -38,3 +38,4 @@ sr-primitives = { path = "../core/sr-primitives" }
|
||||
|
||||
[build-dependencies]
|
||||
vergen = "3.0.4"
|
||||
build-script-utils = { package = "substrate-build-script-utils", path = "../core/utils/build-script-utils" }
|
||||
|
||||
@@ -7,18 +7,5 @@ const ERROR_MSG: &str = "Failed to generate metadata files";
|
||||
fn main() {
|
||||
generate_cargo_keys(ConstantsFlags::SHA_SHORT).expect(ERROR_MSG);
|
||||
|
||||
let mut manifest_dir = PathBuf::from(
|
||||
env::var("CARGO_MANIFEST_DIR").expect("`CARGO_MANIFEST_DIR` is always set by cargo.")
|
||||
);
|
||||
|
||||
while manifest_dir.parent().is_some() {
|
||||
if manifest_dir.join(".git/HEAD").exists() {
|
||||
println!("cargo:rerun-if-changed={}", manifest_dir.join(".git/HEAD").display());
|
||||
return
|
||||
}
|
||||
|
||||
manifest_dir.pop();
|
||||
}
|
||||
|
||||
println!("cargo:warning=Could not find `.git/HEAD` from manifest dir!");
|
||||
build_script_utils::rerun_if_git_head_changed();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user