From 54f6768d03e6edd7c46447dca0eb0a3970d79fff Mon Sep 17 00:00:00 2001 From: Felix Werner Date: Wed, 4 Feb 2026 09:17:04 +0100 Subject: [PATCH] chore: remove wasm lib files after generating ts bindings Keeping these files causes issues when running jvm-test or ios-test after ts bindings generation. It's cheap to regenerate them so we just remove them after bindings generation. We also change the execution order for `make local` to run ts since kotlin and swift use the same lib files. --- Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 24f4bbcb40..51017638b1 100644 --- a/Makefile +++ b/Makefile @@ -484,10 +484,18 @@ WASM_GEN := $(wildcard $(GEN_DIR)/wasm-bindgen/*) $(GEN_DIR)/core_crypto_ffi.ts # As soon as ubrn allows reusage of an existing ffi lib, we need to depend on it here. wasm-build-deps := $(RUST_SOURCES) $(BUN_LOCK) $(NODE_MODULES) $(PACKAGE_JSON) $(BUNFIG) +# index.web.ts is generated but unused so we remove it +# We remove library files because wasm-only symbols cause errors when running ios/jvm tests with these files +# Note that ubrn always generates these in debug mode $(WASM_GEN): $(wasm-build-deps) cd $(JS_DIR) && \ RUSTFLAGS="" bun ubrn build web $(CARGO_BUILD_ARGS) && \ - rm src/index.web.ts # This file is generated but we don't use it + rm src/index.web.ts && \ + cd ../../../target/debug && \ + rm libcore_crypto_ffi.a && \ + rm libcore_crypto_ffi.d && \ + rm libcore_crypto_ffi.$(LIBRARY_EXTENSION) && \ + rm libcore_crypto_ffi.rlib wasm-build: $(WASM_GEN) # generate TypeScript defs only when corecrypto.js changed @@ -636,7 +644,7 @@ docs: docs-rust-generic docs-rust-wasm docs-kotlin docs-ts $(if $(filter Darwin, .PHONY: wasm bindings local all clean wasm: ts ## Alias for ts -bindings: bindings-kotlin ts $(if $(filter Darwin,$(UNAME_S)),bindings-swift) ## Generate all bindings +bindings: bindings-kotlin $(if $(filter Darwin,$(UNAME_S)),bindings-swift) ts ## Generate all bindings local: bindings ts-fmt ## Generate and format all bindings all: android wasm jvm $(if $(filter Darwin,$(UNAME_S)),ios) docs ## Generate bindings for all platforms (android, iOS, wasm) and generate docs clean: ts-clean ## Run cargo clean and the ts-clean target, remove all stamps