diff --git a/utils/wasm-dep-builder/src/builder.rs b/utils/wasm-dep-builder/src/builder.rs index e5a139abafe..7100b11fc83 100644 --- a/utils/wasm-dep-builder/src/builder.rs +++ b/utils/wasm-dep-builder/src/builder.rs @@ -192,10 +192,13 @@ impl BuildPackages { self.packages.push(build_pkg); } - fn rebuild_required(&self) -> bool { - self.packages + pub fn skip_build(&self) -> bool { + let any_dirty = self + .packages .iter() - .any(|pkg| pkg.rebuild_kind == RebuildKind::Dirty) + .any(|pkg| pkg.rebuild_kind == RebuildKind::Dirty); + + get_no_build_env() || !any_dirty } fn cargo_args(&self) -> impl Iterator + '_ { @@ -236,7 +239,7 @@ impl BuildPackages { } pub fn build(&mut self) { - if get_no_build_env() || !self.rebuild_required() { + if self.skip_build() { println!("cargo:warning=Build skipped"); return; } diff --git a/utils/wasm-dep-builder/src/lib.rs b/utils/wasm-dep-builder/src/lib.rs index 99f6361367c..23dfb86a905 100644 --- a/utils/wasm-dep-builder/src/lib.rs +++ b/utils/wasm-dep-builder/src/lib.rs @@ -114,8 +114,10 @@ pub fn builder() { println!("cargo:warning={:?}", packages); packages.build(); - for (mut lock, config) in locks { - lock.write(config); + if packages.skip_build() { + for (mut lock, config) in locks { + lock.write(config); + } } let wasm_binaries = packages.wasm_binaries();