Skip to content

Commit acba144

Browse files
committed
Merge remote-tracking branch 'upstream/master' into 20201113-update
* upstream/master: Use cargo-raze's gen_buildrs for trusted crates. (proxy-wasm#53) Show getrandom and chrono/time usage in examples. (proxy-wasm#51) Allow building for wasm32-wasi target using Bazel. (proxy-wasm#50) Update cargo-raze to latest and regenerate artifacts. (proxy-wasm#47) Update rules_rust to latest. (proxy-wasm#46)
2 parents f1dd449 + 4cb2db7 commit acba144

34 files changed

+1135
-508
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: 6 additions & 3 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: |
@@ -72,7 +75,7 @@ jobs:
7275
7376
- name: Format (cargo raze)
7477
run: |
75-
cargo install cargo-raze --version 0.3.8
78+
cargo install cargo-raze --version 0.7.0
7679
cp -p bazel/cargo/Cargo.lock .
7780
rm -rf bazel/cargo/
7881
cargo raze --output=bazel/cargo

Cargo.toml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,29 @@ log = "0.4"
1717
wee_alloc = { version = "0.4", optional = true }
1818

1919
[dev-dependencies]
20+
cfg-if = "1.0"
2021
chrono = "0.4"
2122

23+
[target.'cfg(not(all(target_arch = "wasm32", target_os = "unknown")))'.dev-dependencies]
24+
getrandom = "0.2"
25+
2226
[profile.release]
2327
lto = true
2428
opt-level = 3
2529
panic = "abort"
2630

27-
[raze]
31+
[package.metadata.raze]
2832
workspace_path = "//bazel/cargo"
29-
target = "wasm32-unknown-unknown"
3033
genmode = "Remote"
3134

32-
[raze.crates.log.'0.4.11']
33-
additional_flags = ["--cfg=atomic_cas"]
35+
[package.metadata.raze.crates.getrandom.'=0.2.0']
36+
gen_buildrs = true
37+
38+
[package.metadata.raze.crates.libc.'=0.2.80']
39+
gen_buildrs = true
40+
41+
[package.metadata.raze.crates.log.'=0.4.11']
42+
gen_buildrs = true
3443

3544
[[example]]
3645
name = "hello_world"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ upstream won't add or is undecided or unresponsive about.
4343

4444
When updating dependencies, you need to regenerate `BUILD` files to match updated `Cargo.toml`:
4545
```
46-
cargo install cargo-raze --version 0.3.8
46+
cargo install cargo-raze --git https://github.com/google/cargo-raze --rev cb9f85d22b1c81cceb9acaf1fa4336c5fc4e6bff
4747
rm -rf bazel/cargo/
4848
cargo generate-lockfile
4949
cargo raze --output=bazel/cargo
5050
mv Cargo.lock bazel/cargo/
51-
```
51+
```

WORKSPACE

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,20 @@ workspace(name = "proxy_wasm_rust_sdk")
22

33
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
44

5-
http_archive(
6-
name = "bazel_skylib",
7-
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
8-
urls = [
9-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
10-
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
11-
],
12-
)
13-
14-
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
15-
16-
bazel_skylib_workspace()
17-
185
http_archive(
196
name = "io_bazel_rules_rust",
20-
sha256 = "484a2b2b67cd2d1fa1054876de7f8d291c4b203fd256bc8cbea14d749bb864ce",
21-
# Last commit where "out_binary = True" works.
22-
# See: https://github.com/bazelbuild/rules_rust/issues/386
23-
strip_prefix = "rules_rust-fda9a1ce6482973adfda022cadbfa6b300e269c3",
24-
url = "https://github.com/bazelbuild/rules_rust/archive/fda9a1ce6482973adfda022cadbfa6b300e269c3.tar.gz",
7+
sha256 = "17dbf791f4dab0fd4496ce5345af35e9ce2f6d011c1c8423436da517d019a3ea",
8+
strip_prefix = "rules_rust-2f97db595b05b1ee8cc44bde5bdf03c00bd169fb",
9+
url = "https://github.com/bazelbuild/rules_rust/archive/2f97db595b05b1ee8cc44bde5bdf03c00bd169fb.tar.gz",
2510
)
2611

2712
load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories")
2813

2914
rust_repositories()
3015

31-
load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version")
16+
load("@io_bazel_rules_rust//:workspace.bzl", "rust_workspace")
3217

33-
bazel_version(name = "bazel_version")
18+
rust_workspace()
3419

3520
load("//bazel/cargo:crates.bzl", "raze_fetch_remote_crates")
3621

bazel/cargo/BUILD

Lines changed: 0 additions & 25 deletions
This file was deleted.

bazel/cargo/BUILD.bazel

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
"""
2+
@generated
3+
cargo-raze generated Bazel file.
4+
5+
DO NOT EDIT! Replaced on runs of cargo-raze
6+
"""
7+
8+
package(default_visibility = ["//visibility:public"])
9+
10+
licenses([
11+
"notice", # See individual crates for specific licenses
12+
])
13+
14+
# Aliased targets
15+
alias(
16+
name = "cfg_if",
17+
actual = "@raze__cfg_if__1_0_0//:cfg_if",
18+
tags = [
19+
"cargo-raze",
20+
"manual",
21+
],
22+
)
23+
24+
alias(
25+
name = "chrono",
26+
actual = "@raze__chrono__0_4_19//:chrono",
27+
tags = [
28+
"cargo-raze",
29+
"manual",
30+
],
31+
)
32+
33+
alias(
34+
name = "getrandom",
35+
actual = "@raze__getrandom__0_2_0//:getrandom",
36+
tags = [
37+
"cargo-raze",
38+
"manual",
39+
],
40+
)
41+
42+
alias(
43+
name = "hashbrown",
44+
actual = "@raze__hashbrown__0_9_1//:hashbrown",
45+
tags = [
46+
"cargo-raze",
47+
"manual",
48+
],
49+
)
50+
51+
alias(
52+
name = "log",
53+
actual = "@raze__log__0_4_11//:log",
54+
tags = [
55+
"cargo-raze",
56+
"manual",
57+
],
58+
)

bazel/cargo/Cargo.lock

Lines changed: 28 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)