Skip to content

Commit 1d955c8

Browse files
committed
Ensure build scripts and dev features account for getrandom config
1 parent e68b5ce commit 1d955c8

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ jobs:
172172
with:
173173
target: wasm32-unknown-unknown
174174
- name: Check wasm
175+
env:
176+
RUSTFLAGS: --cfg getrandom_backend="wasm_js"
175177
run: cargo check --target wasm32-unknown-unknown
176178

177179
build-wasm-atomics:
@@ -197,7 +199,7 @@ jobs:
197199
- name: Check wasm
198200
run: cargo check --target wasm32-unknown-unknown -Z build-std=std,panic_abort
199201
env:
200-
RUSTFLAGS: "-C target-feature=+atomics,+bulk-memory -D warnings"
202+
RUSTFLAGS: '-C target-feature=+atomics,+bulk-memory -D warnings --cfg getrandom_backend="wasm_js"'
201203

202204
markdownlint:
203205
runs-on: ubuntu-latest

.github/workflows/validation-jobs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ jobs:
112112
cd ../..
113113
114114
- name: First Wasm build
115+
env:
116+
RUSTFLAGS: --cfg getrandom_backend="wasm_js"
115117
run: |
116118
cargo build --release --example testbed_ui --target wasm32-unknown-unknown
117119

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ smol-hyper = "0.1"
533533
ureq = { version = "2.10.1", features = ["json"] }
534534

535535
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
536+
getrandom = { version = "0.3", features = ["wasm_js"] }
536537
wasm-bindgen = { version = "0.2" }
537538
web-sys = { version = "0.3", features = ["Window"] }
538539

crates/bevy_render/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ thiserror = { version = "2", default-features = false }
8888
derive_more = { version = "1", default-features = false, features = ["from"] }
8989
futures-lite = "2.0.1"
9090
ktx2 = { version = "0.3.0", optional = true }
91-
encase = { git = "https://github.com/waywardmonkeys/encase/", branch = "update-deps", features = ["glam"] }
91+
encase = { git = "https://github.com/waywardmonkeys/encase/", branch = "update-deps", features = [
92+
"glam",
93+
] }
9294
# For wgpu profiling using tracing. Use `RUST_LOG=info` to also capture the wgpu spans.
9395
profiling = { version = "1", features = [
9496
"profile-with-tracing",

tools/build-wasm-example/src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ fn main() {
7777
sh,
7878
"cargo build {parameters...} --profile release --target wasm32-unknown-unknown --example {example}"
7979
);
80-
cmd.run().expect("Error building example");
80+
cmd.env("RUSTFLAGS", "--cfg getrandom_backend=\"wasm_js\"")
81+
.run()
82+
.expect("Error building example");
8183

8284
cmd!(
8385
sh,

0 commit comments

Comments
 (0)