From aa0eb4bedf7143334b686a90cf4182a1ebb429e6 Mon Sep 17 00:00:00 2001 From: "Jeong, YunWon" <69878+youknowone@users.noreply.github.com> Date: Wed, 17 Sep 2025 09:11:13 +0900 Subject: [PATCH] rustpython-common wasm_js feature (#6116) --- .cargo/config.toml | 3 +++ common/Cargo.toml | 1 + vm/Cargo.toml | 2 +- wasm/lib/.cargo/config.toml | 3 --- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index a590c044d..635229119 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -3,3 +3,6 @@ rustflags = "-C link-arg=/STACK:8000000" [target.'cfg(all(target_os = "windows", not(target_env = "msvc")))'] rustflags = "-C link-args=-Wl,--stack,8000000" + +[target.wasm32-unknown-unknown] +rustflags = ["--cfg=getrandom_backend=\"wasm_js\""] diff --git a/common/Cargo.toml b/common/Cargo.toml index fd6f31d4b..c75f33a7b 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -10,6 +10,7 @@ license.workspace = true [features] threading = ["parking_lot"] +wasm_js = ["getrandom/wasm_js"] [dependencies] rustpython-literal = { workspace = true } diff --git a/vm/Cargo.toml b/vm/Cargo.toml index eb848f17a..ffd583617 100644 --- a/vm/Cargo.toml +++ b/vm/Cargo.toml @@ -24,7 +24,7 @@ ast = ["ruff_python_ast", "ruff_text_size"] codegen = ["rustpython-codegen", "ast"] parser = ["ast"] serde = ["dep:serde"] -wasmbind = ["chrono/wasmbind", "getrandom/wasm_js", "wasm-bindgen"] +wasmbind = ["rustpython-common/wasm_js", "chrono/wasmbind", "wasm-bindgen"] [dependencies] rustpython-compiler = { workspace = true, optional = true } diff --git a/wasm/lib/.cargo/config.toml b/wasm/lib/.cargo/config.toml index ce1e7c694..f4e8c002f 100644 --- a/wasm/lib/.cargo/config.toml +++ b/wasm/lib/.cargo/config.toml @@ -1,5 +1,2 @@ [build] target = "wasm32-unknown-unknown" - -[target.wasm32-unknown-unknown] -rustflags = ["--cfg=getrandom_backend=\"wasm_js\""]