Skip to content

Commit e923d68

Browse files
authored
Allow building for wasm32-wasi target using Bazel. (proxy-wasm#50)
While there, update Bazel to 3.7.0. Signed-off-by: Piotr Sikora <[email protected]>
1 parent 7b24544 commit e923d68

File tree

5 files changed

+26
-5
lines changed

5 files changed

+26
-5
lines changed

.bazelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# Force Bazel to use --target=wasm32-unknown-unknown.
2-
build --platforms=@io_bazel_rules_rust//rust/platform:wasm
1+
# Force Bazel to use --target=wasm32-wasi
2+
build --platforms=@io_bazel_rules_rust//rust/platform:wasi

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.4.1
1+
3.7.0

.github/workflows/rust.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ jobs:
5959
~/.cargo/registry
6060
key: ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.lock') }}
6161

62-
- name: Build
63-
run: bazelisk build //...
62+
- name: Build (wasm32-unknown-unknown)
63+
run: bazelisk --bazelrc=/dev/null build --platforms=@io_bazel_rules_rust//rust/platform:wasm //...
64+
65+
- name: Build (wasm32-wasi)
66+
run: bazelisk --bazelrc=/dev/null build --platforms=@io_bazel_rules_rust//rust/platform:wasi //...
6467

6568
- name: Format (buildifier)
6669
run: |

Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ panic = "abort"
2828
workspace_path = "//bazel/cargo"
2929
genmode = "Remote"
3030

31+
[package.metadata.raze.crates.libc.'0.2.80']
32+
additional_flags = [
33+
"--cfg=libc_priv_mod_use",
34+
"--cfg=libc_union",
35+
"--cfg=libc_const_size_of",
36+
"--cfg=libc_align",
37+
"--cfg=libc_core_cvoid",
38+
"--cfg=libc_packedN",
39+
"--cfg=libc_cfg_target_vendor",
40+
]
41+
3142
[package.metadata.raze.crates.log.'0.4.11']
3243
additional_flags = ["--cfg=atomic_cas"]
3344

bazel/cargo/remote/BUILD.libc-0.2.80.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ rust_library(
4444
edition = "2015",
4545
rustc_flags = [
4646
"--cap-lints=allow",
47+
"--cfg=libc_priv_mod_use",
48+
"--cfg=libc_union",
49+
"--cfg=libc_const_size_of",
50+
"--cfg=libc_align",
51+
"--cfg=libc_core_cvoid",
52+
"--cfg=libc_packedN",
53+
"--cfg=libc_cfg_target_vendor",
4754
],
4855
tags = [
4956
"cargo-raze",

0 commit comments

Comments
 (0)