Skip to content

Commit

Permalink
Don't write config if there was no actual build
Browse files Browse the repository at this point in the history
  • Loading branch information
ark0f committed Jan 16, 2024
1 parent 0adc9e4 commit 45eeb7b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 7 additions & 4 deletions utils/wasm-dep-builder/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Item = String> + '_ {
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 4 additions & 2 deletions utils/wasm-dep-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 45eeb7b

Please sign in to comment.