diff --git a/.github/workflows/wasm_exports.yml b/.github/workflows/wasm_exports.yml index 19c9c6e5..febceb44 100644 --- a/.github/workflows/wasm_exports.yml +++ b/.github/workflows/wasm_exports.yml @@ -32,5 +32,9 @@ jobs: env: CFLAGS: -g -Werror -Wall -Wextra -Wshadow -Wpedantic -Werror=incompatible-pointer-types + - name: Build WASM Library + working-directory: lib/binding_web + run: npm ci && npm run build:debug + - name: Check WASM exports run: cargo xtask check-wasm-exports diff --git a/xtask/src/build_wasm.rs b/xtask/src/build_wasm.rs index ddf7477e..5650cde7 100644 --- a/xtask/src/build_wasm.rs +++ b/xtask/src/build_wasm.rs @@ -25,6 +25,18 @@ enum EmccSource { } pub fn run_wasm(args: &BuildWasm) -> Result<()> { + let npm = if cfg!(target_os = "windows") { + "npm.cmd" + } else { + "npm" + }; + let npm = Command::new(npm) + .current_dir("lib/binding_web") + .args(["run", "build:ts"]) + .output() + .expect("Failed to run npm run build:ts"); + bail_on_err(&npm, "Failed to run npm run build:ts")?; + let mut emscripten_flags = vec!["-O3", "--minify", "0"]; if args.debug { diff --git a/xtask/src/check_wasm_exports.rs b/xtask/src/check_wasm_exports.rs index 167a5019..4d6fa943 100644 --- a/xtask/src/check_wasm_exports.rs +++ b/xtask/src/check_wasm_exports.rs @@ -13,7 +13,7 @@ use notify::{ }; use notify_debouncer_full::new_debouncer; -use crate::{bail_on_err, build_wasm::run_wasm, watch_wasm, BuildWasm, CheckWasmExports}; +use crate::{bail_on_err, watch_wasm, CheckWasmExports}; const EXCLUDES: [&str; 27] = [ // Unneeded because the JS side has its own way of implementing it @@ -60,15 +60,7 @@ pub fn run(args: &CheckWasmExports) -> Result<()> { } fn check_wasm_exports() -> Result<()> { - // Build the wasm module with debug symbols for wasm-objdump - run_wasm(&BuildWasm { - debug: true, - verbose: false, - docker: false, - watch: false, - })?; - - let mut wasm_exports = std::fs::read_to_string("lib/binding_web/exports.txt")? + let mut wasm_exports = std::fs::read_to_string("lib/binding_web/wasm/exports.txt")? .lines() .map(|s| s.replace("_wasm", "").replace("byte", "index")) // remove leading and trailing quotes, trailing comma