Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into 20201113-update
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
unleashed committed Nov 13, 2020
2 parents f1dd449 + 4cb2db7 commit acba144
Show file tree
Hide file tree
Showing 34 changed files with 1,135 additions and 508 deletions.
4 changes: 2 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Force Bazel to use --target=wasm32-unknown-unknown.
build --platforms=@io_bazel_rules_rust//rust/platform:wasm
# Force Bazel to use --target=wasm32-wasi
build --platforms=@io_bazel_rules_rust//rust/platform:wasi
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.4.1
3.7.0
9 changes: 6 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ jobs:
~/.cargo/registry
key: ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.lock') }}

- name: Build
run: bazelisk build //...
- name: Build (wasm32-unknown-unknown)
run: bazelisk --bazelrc=/dev/null build --platforms=@io_bazel_rules_rust//rust/platform:wasm //...

- name: Build (wasm32-wasi)
run: bazelisk --bazelrc=/dev/null build --platforms=@io_bazel_rules_rust//rust/platform:wasi //...

- name: Format (buildifier)
run: |
Expand All @@ -72,7 +75,7 @@ jobs:
- name: Format (cargo raze)
run: |
cargo install cargo-raze --version 0.3.8
cargo install cargo-raze --version 0.7.0
cp -p bazel/cargo/Cargo.lock .
rm -rf bazel/cargo/
cargo raze --output=bazel/cargo
Expand Down
17 changes: 13 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,29 @@ log = "0.4"
wee_alloc = { version = "0.4", optional = true }

[dev-dependencies]
cfg-if = "1.0"
chrono = "0.4"

[target.'cfg(not(all(target_arch = "wasm32", target_os = "unknown")))'.dev-dependencies]
getrandom = "0.2"

[profile.release]
lto = true
opt-level = 3
panic = "abort"

[raze]
[package.metadata.raze]
workspace_path = "//bazel/cargo"
target = "wasm32-unknown-unknown"
genmode = "Remote"

[raze.crates.log.'0.4.11']
additional_flags = ["--cfg=atomic_cas"]
[package.metadata.raze.crates.getrandom.'=0.2.0']
gen_buildrs = true

[package.metadata.raze.crates.libc.'=0.2.80']
gen_buildrs = true

[package.metadata.raze.crates.log.'=0.4.11']
gen_buildrs = true

[[example]]
name = "hello_world"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ upstream won't add or is undecided or unresponsive about.

When updating dependencies, you need to regenerate `BUILD` files to match updated `Cargo.toml`:
```
cargo install cargo-raze --version 0.3.8
cargo install cargo-raze --git https://github.com/google/cargo-raze --rev cb9f85d22b1c81cceb9acaf1fa4336c5fc4e6bff
rm -rf bazel/cargo/
cargo generate-lockfile
cargo raze --output=bazel/cargo
mv Cargo.lock bazel/cargo/
```
```
25 changes: 5 additions & 20 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,20 @@ workspace(name = "proxy_wasm_rust_sdk")

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

http_archive(
name = "bazel_skylib",
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
],
)

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

http_archive(
name = "io_bazel_rules_rust",
sha256 = "484a2b2b67cd2d1fa1054876de7f8d291c4b203fd256bc8cbea14d749bb864ce",
# Last commit where "out_binary = True" works.
# See: https://github.com/bazelbuild/rules_rust/issues/386
strip_prefix = "rules_rust-fda9a1ce6482973adfda022cadbfa6b300e269c3",
url = "https://github.com/bazelbuild/rules_rust/archive/fda9a1ce6482973adfda022cadbfa6b300e269c3.tar.gz",
sha256 = "17dbf791f4dab0fd4496ce5345af35e9ce2f6d011c1c8423436da517d019a3ea",
strip_prefix = "rules_rust-2f97db595b05b1ee8cc44bde5bdf03c00bd169fb",
url = "https://github.com/bazelbuild/rules_rust/archive/2f97db595b05b1ee8cc44bde5bdf03c00bd169fb.tar.gz",
)

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

rust_repositories()

load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version")
load("@io_bazel_rules_rust//:workspace.bzl", "rust_workspace")

bazel_version(name = "bazel_version")
rust_workspace()

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

Expand Down
25 changes: 0 additions & 25 deletions bazel/cargo/BUILD

This file was deleted.

58 changes: 58 additions & 0 deletions bazel/cargo/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"""
@generated
cargo-raze generated Bazel file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""

package(default_visibility = ["//visibility:public"])

licenses([
"notice", # See individual crates for specific licenses
])

# Aliased targets
alias(
name = "cfg_if",
actual = "@raze__cfg_if__1_0_0//:cfg_if",
tags = [
"cargo-raze",
"manual",
],
)

alias(
name = "chrono",
actual = "@raze__chrono__0_4_19//:chrono",
tags = [
"cargo-raze",
"manual",
],
)

alias(
name = "getrandom",
actual = "@raze__getrandom__0_2_0//:getrandom",
tags = [
"cargo-raze",
"manual",
],
)

alias(
name = "hashbrown",
actual = "@raze__hashbrown__0_9_1//:hashbrown",
tags = [
"cargo-raze",
"manual",
],
)

alias(
name = "log",
actual = "@raze__log__0_4_11//:log",
tags = [
"cargo-raze",
"manual",
],
)
31 changes: 28 additions & 3 deletions bazel/cargo/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit acba144

Please sign in to comment.