fix(xtask): adapt check-wasm-exports to web changes

This commit is contained in:
Amaan Qureshi 2025-01-16 02:14:40 -05:00
parent 25e6de4a0a
commit b1e39d2dba
3 changed files with 18 additions and 10 deletions

View file

@ -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

View file

@ -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 {

View file

@ -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