Skip to content

Commit 4d1546c

Browse files
committed
fix(xtask): stop the debug bootstrap clobbering the release bindgen
`transpile()` writes the componentized module to `obj/<name>.component.wasm`, then, on a clean `obj/`, runs a debug bootstrap (`transpile_components(BuildType::Debug)`) to build the `wasm-tools` transpiler that `jco opt` needs. That bootstrap transpiles *all* components, including the one currently being built, into the same `obj/*.component.wasm` paths, overwriting the release component with the 132 MiB debug build. `jco opt` and the final transpile then run on the debug component, so `build:release` emits the debug bindgen (wasm-opt'd to ~8.9 MiB / 17,688 funcs) instead of the release one (~3.1 MiB / 7,836 funcs). Re-write the release component to `component_path` after the bootstrap so `jco opt` operates on the release build. The bootstrap only runs when `obj/wasm-tools.js` is absent (a clean checkout), which is exactly how the release workflow builds, so every published js-component-bindgen bindgen was the debug one. Signed-off-by: Alexander Shishenko <alex@shishenko.com>
1 parent 95228c7 commit 4d1546c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

crates/xtask/src/build/jco.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ fn transpile(args: TranspileArgs) -> Result<()> {
144144
transpile_components(BuildType::Debug).context("transpiling all components (debug)")?;
145145
}
146146

147+
// The debug bootstrap above transpiles *all* components (including this
148+
// one) into the same `obj/<name>.component.wasm` paths, overwriting the
149+
// release component written earlier with the debug build. Re-write ours
150+
// so that `jco opt` (and the transpile below) operates on the release
151+
// component, not the debug one.
152+
fs::write(&component_path, &adapted_component)?;
153+
147154
let jco_script_path = format!(
148155
"{}",
149156
WORKSPACE_DIR.join("packages/jco/src/jco.js").display()

0 commit comments

Comments
 (0)