Skip to content

Commit 02c1ca9

Browse files
committed
Ensure build scripts and dev features account for getrandom config
1 parent 208683f commit 02c1ca9

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
@@ -221,6 +221,8 @@ jobs:
221221
with:
222222
target: wasm32-unknown-unknown
223223
- name: Check wasm
224+
env:
225+
RUSTFLAGS: --cfg getrandom_backend="wasm_js"
224226
run: cargo check --target wasm32-unknown-unknown
225227

226228
build-wasm-atomics:
@@ -246,7 +248,7 @@ jobs:
246248
- name: Check wasm
247249
run: cargo check --target wasm32-unknown-unknown -Z build-std=std,panic_abort
248250
env:
249-
RUSTFLAGS: "-C target-feature=+atomics,+bulk-memory -D warnings"
251+
RUSTFLAGS: '-C target-feature=+atomics,+bulk-memory -D warnings --cfg getrandom_backend="wasm_js"'
250252

251253
markdownlint:
252254
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
@@ -582,6 +582,7 @@ smol-hyper = "0.1"
582582
ureq = { version = "3.0.8", features = ["json"] }
583583

584584
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
585+
getrandom = { version = "0.3", features = ["wasm_js"] }
585586
wasm-bindgen = { version = "0.2" }
586587
web-sys = { version = "0.3", features = ["Window"] }
587588

crates/bevy_render/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ thiserror = { version = "2", default-features = false }
9999
derive_more = { version = "1", default-features = false, features = ["from"] }
100100
futures-lite = "2.0.1"
101101
ktx2 = { version = "0.3.0", optional = true }
102-
encase = { git = "https://github.com/waywardmonkeys/encase/", branch = "update-deps", features = ["glam"] }
102+
encase = { git = "https://github.com/waywardmonkeys/encase/", branch = "update-deps", features = [
103+
"glam",
104+
] }
103105
# For wgpu profiling using tracing. Use `RUST_LOG=info` to also capture the wgpu spans.
104106
profiling = { version = "1", features = [
105107
"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)