Skip to content

Commit

Permalink
Update cargo-raze to v0.11.0. (proxy-wasm#88)
Browse files Browse the repository at this point in the history
While there, add support for generating BUILD files
with Bazel using @cargo_raze//:raze.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
  • Loading branch information
PiotrSikora authored and nullpo-head committed Apr 20, 2021
1 parent 00ee283 commit 78220a9
Show file tree
Hide file tree
Showing 20 changed files with 81 additions and 54 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ jobs:
key: ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.raze.lock', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}

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

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

- name: Format (buildifier)
run: |
Expand All @@ -76,9 +76,7 @@ jobs:
- name: Format (cargo raze)
run: |
mv bazel/cargo/Cargo.raze.lock Cargo.lock
rm -rf bazel/cargo/
cargo install cargo-raze --version 0.9.2
cargo raze --output=bazel/cargo
bazelisk --noworkspace_rc run @cargo_raze//:raze -- --manifest-path=$(pwd)/Cargo.toml
mv Cargo.lock bazel/cargo/Cargo.raze.lock
git diff --exit-code
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ opt-level = 3
panic = "abort"

[package.metadata.raze]
rust_rules_workspace_name = "rules_rust"
package_aliases_dir = "bazel/cargo"
workspace_path = "//bazel/cargo"
genmode = "Remote"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@

When updating dependencies, you need to regenerate Bazel `BUILD` files to match updated `Cargo.toml`:
```
cargo install cargo-raze --version 0.9.2
cargo raze --generate-lockfile --output=bazel/cargo
cargo install cargo-raze --version 0.11.0
cargo raze --generate-lockfile
```
20 changes: 20 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,23 @@ proxy_wasm_rust_sdk_repositories()
load("@proxy_wasm_rust_sdk//bazel:dependencies.bzl", "proxy_wasm_rust_sdk_dependencies")

proxy_wasm_rust_sdk_dependencies()

# Needed only when using @cargo_raze//:raze to generate BUILD files in //bazel/cargo.

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

http_archive(
name = "cargo_raze",
sha256 = "73c5cea8ad3f4ef7788116d491070eeb27819fe0f923dbb6f451f69dd5fa752c",
# v0.11.0 with a few Bazel fixes.
strip_prefix = "cargo-raze-7614085d2748e55ad3032c9b1dca78f6011cb40e",
url = "https://github.com/google/cargo-raze/archive/7614085d2748e55ad3032c9b1dca78f6011cb40e.tar.gz",
)

load("@cargo_raze//:repositories.bzl", "cargo_raze_repositories")

cargo_raze_repositories()

load("@cargo_raze//:transitive_deps.bzl", "cargo_raze_transitive_deps")

cargo_raze_transitive_deps()
6 changes: 3 additions & 3 deletions bazel/cargo/remote/BUILD.ahash-0.4.7.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ cargo-raze crate build file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

# buildifier: disable=load
load(
"@rules_rust//rust:rust.bzl",
Expand All @@ -13,9 +16,6 @@ load(
"rust_test",
)

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

package(default_visibility = [
# Public for visibility by "@raze__crate__version//" targets.
#
Expand Down
6 changes: 3 additions & 3 deletions bazel/cargo/remote/BUILD.autocfg-1.0.1.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ cargo-raze crate build file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

# buildifier: disable=load
load(
"@rules_rust//rust:rust.bzl",
Expand All @@ -13,9 +16,6 @@ load(
"rust_test",
)

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

package(default_visibility = [
# Public for visibility by "@raze__crate__version//" targets.
#
Expand Down
6 changes: 3 additions & 3 deletions bazel/cargo/remote/BUILD.cfg-if-1.0.0.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ cargo-raze crate build file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

# buildifier: disable=load
load(
"@rules_rust//rust:rust.bzl",
Expand All @@ -13,9 +16,6 @@ load(
"rust_test",
)

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

package(default_visibility = [
# Public for visibility by "@raze__crate__version//" targets.
#
Expand Down
6 changes: 3 additions & 3 deletions bazel/cargo/remote/BUILD.chrono-0.4.19.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ cargo-raze crate build file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

# buildifier: disable=load
load(
"@rules_rust//rust:rust.bzl",
Expand All @@ -13,9 +16,6 @@ load(
"rust_test",
)

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

package(default_visibility = [
# Public for visibility by "@raze__crate__version//" targets.
#
Expand Down
7 changes: 4 additions & 3 deletions bazel/cargo/remote/BUILD.getrandom-0.2.2.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ cargo-raze crate build file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

# buildifier: disable=load
load(
"@rules_rust//rust:rust.bzl",
Expand All @@ -13,9 +16,6 @@ load(
"rust_test",
)

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

package(default_visibility = [
# Public for visibility by "@raze__crate__version//" targets.
#
Expand All @@ -29,6 +29,7 @@ licenses([
])

# Generated Targets
# buildifier: disable=out-of-order-load
# buildifier: disable=load-on-top
load(
"@rules_rust//cargo:cargo_build_script.bzl",
Expand Down
6 changes: 3 additions & 3 deletions bazel/cargo/remote/BUILD.hashbrown-0.9.1.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ cargo-raze crate build file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

# buildifier: disable=load
load(
"@rules_rust//rust:rust.bzl",
Expand All @@ -13,9 +16,6 @@ load(
"rust_test",
)

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

package(default_visibility = [
# Public for visibility by "@raze__crate__version//" targets.
#
Expand Down
7 changes: 4 additions & 3 deletions bazel/cargo/remote/BUILD.libc-0.2.88.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ cargo-raze crate build file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

# buildifier: disable=load
load(
"@rules_rust//rust:rust.bzl",
Expand All @@ -13,9 +16,6 @@ load(
"rust_test",
)

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

package(default_visibility = [
# Public for visibility by "@raze__crate__version//" targets.
#
Expand All @@ -29,6 +29,7 @@ licenses([
])

# Generated Targets
# buildifier: disable=out-of-order-load
# buildifier: disable=load-on-top
load(
"@rules_rust//cargo:cargo_build_script.bzl",
Expand Down
7 changes: 4 additions & 3 deletions bazel/cargo/remote/BUILD.log-0.4.14.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ cargo-raze crate build file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

# buildifier: disable=load
load(
"@rules_rust//rust:rust.bzl",
Expand All @@ -13,9 +16,6 @@ load(
"rust_test",
)

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

package(default_visibility = [
# Public for visibility by "@raze__crate__version//" targets.
#
Expand All @@ -29,6 +29,7 @@ licenses([
])

# Generated Targets
# buildifier: disable=out-of-order-load
# buildifier: disable=load-on-top
load(
"@rules_rust//cargo:cargo_build_script.bzl",
Expand Down
7 changes: 4 additions & 3 deletions bazel/cargo/remote/BUILD.num-integer-0.1.44.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ cargo-raze crate build file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

# buildifier: disable=load
load(
"@rules_rust//rust:rust.bzl",
Expand All @@ -13,9 +16,6 @@ load(
"rust_test",
)

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

package(default_visibility = [
# Public for visibility by "@raze__crate__version//" targets.
#
Expand All @@ -29,6 +29,7 @@ licenses([
])

# Generated Targets
# buildifier: disable=out-of-order-load
# buildifier: disable=load-on-top
load(
"@rules_rust//cargo:cargo_build_script.bzl",
Expand Down
7 changes: 4 additions & 3 deletions bazel/cargo/remote/BUILD.num-traits-0.2.14.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ cargo-raze crate build file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

# buildifier: disable=load
load(
"@rules_rust//rust:rust.bzl",
Expand All @@ -13,9 +16,6 @@ load(
"rust_test",
)

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

package(default_visibility = [
# Public for visibility by "@raze__crate__version//" targets.
#
Expand All @@ -29,6 +29,7 @@ licenses([
])

# Generated Targets
# buildifier: disable=out-of-order-load
# buildifier: disable=load-on-top
load(
"@rules_rust//cargo:cargo_build_script.bzl",
Expand Down
6 changes: 3 additions & 3 deletions bazel/cargo/remote/BUILD.time-0.1.43.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ cargo-raze crate build file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

# buildifier: disable=load
load(
"@rules_rust//rust:rust.bzl",
Expand All @@ -13,9 +16,6 @@ load(
"rust_test",
)

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

package(default_visibility = [
# Public for visibility by "@raze__crate__version//" targets.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ cargo-raze crate build file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

# buildifier: disable=load
load(
"@rules_rust//rust:rust.bzl",
Expand All @@ -13,9 +16,6 @@ load(
"rust_test",
)

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

package(default_visibility = [
# Public for visibility by "@raze__crate__version//" targets.
#
Expand Down
7 changes: 4 additions & 3 deletions bazel/cargo/remote/BUILD.winapi-0.3.9.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ cargo-raze crate build file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

# buildifier: disable=load
load(
"@rules_rust//rust:rust.bzl",
Expand All @@ -13,9 +16,6 @@ load(
"rust_test",
)

# buildifier: disable=load
load("@bazel_skylib//lib:selects.bzl", "selects")

package(default_visibility = [
# Public for visibility by "@raze__crate__version//" targets.
#
Expand All @@ -29,6 +29,7 @@ licenses([
])

# Generated Targets
# buildifier: disable=out-of-order-load
# buildifier: disable=load-on-top
load(
"@rules_rust//cargo:cargo_build_script.bzl",
Expand Down
Loading

0 comments on commit 78220a9

Please sign in to comment.