Skip to content

Commit aa845f9

Browse files
committed
fix(bb): cache Emscripten .js loader and .worker.mjs siblings of .wasm targets
preset_cache_paths only matched targets by name + native sibling extensions (.exe, .node, lib*.a). Emscripten emits a .js loader and .worker.mjs pthread worker alongside every .wasm exec target as a unit, so cache_upload missed them and a wasm-threads cache hit restored barretenberg.wasm without the matching barretenberg.js. bb-ts/scripts/copy_wasm.sh then unconditionally copies cpp/build-wasm-threads/ bin/barretenberg.js into dest/<flavor>/barretenberg_wasm/, which fast-mode CI hits before any cache miss can rebuild the cpp side, producing: cp: cannot stat '../cpp/build-wasm-threads/bin/barretenberg.js': No such file or directory Extend preset_cache_paths so any target ending in .wasm also picks up the $stem.js and $stem.worker.mjs siblings from the same bin/ directory.
1 parent d6a4fc6 commit aa845f9

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

barretenberg/cpp/bootstrap.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ function preset_cache_paths {
8787
find $build_dir/bin $build_dir/lib \
8888
-maxdepth 1 \( -name "$t" -o -name "$t.exe" -o -name "$t.node" -o -name "lib${t}.a" \) \
8989
2>/dev/null
90+
# Emscripten emits a .js loader and a .worker.mjs pthread worker as
91+
# side-outputs of any .wasm executable target; cache them next to the
92+
# .wasm so consumers like bb.js see a complete artifact set on cache hit.
93+
if [[ "$t" == *.wasm ]]; then
94+
local stem="${t%.wasm}"
95+
find $build_dir/bin -maxdepth 1 \
96+
\( -name "$stem.js" -o -name "$stem.worker.mjs" \) \
97+
2>/dev/null
98+
fi
9099
done
91100
fi
92101
}

0 commit comments

Comments
 (0)