diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b290a6a0..1dbd5adf 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -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: | @@ -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 diff --git a/Cargo.toml b/Cargo.toml index 03a7c37b..49855fbf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/README.md b/README.md index 8e66cfb1..f7f0c023 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/WORKSPACE b/WORKSPACE index 4261aeed..d409f914 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -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() diff --git a/bazel/cargo/remote/BUILD.ahash-0.4.7.bazel b/bazel/cargo/remote/BUILD.ahash-0.4.7.bazel index 3646eb2d..656cc999 100644 --- a/bazel/cargo/remote/BUILD.ahash-0.4.7.bazel +++ b/bazel/cargo/remote/BUILD.ahash-0.4.7.bazel @@ -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", @@ -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. # diff --git a/bazel/cargo/remote/BUILD.autocfg-1.0.1.bazel b/bazel/cargo/remote/BUILD.autocfg-1.0.1.bazel index d348f9b4..22a819b6 100644 --- a/bazel/cargo/remote/BUILD.autocfg-1.0.1.bazel +++ b/bazel/cargo/remote/BUILD.autocfg-1.0.1.bazel @@ -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", @@ -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. # diff --git a/bazel/cargo/remote/BUILD.cfg-if-1.0.0.bazel b/bazel/cargo/remote/BUILD.cfg-if-1.0.0.bazel index f3bd70dd..c921ef91 100644 --- a/bazel/cargo/remote/BUILD.cfg-if-1.0.0.bazel +++ b/bazel/cargo/remote/BUILD.cfg-if-1.0.0.bazel @@ -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", @@ -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. # diff --git a/bazel/cargo/remote/BUILD.chrono-0.4.19.bazel b/bazel/cargo/remote/BUILD.chrono-0.4.19.bazel index f97ea46b..feaf5c56 100644 --- a/bazel/cargo/remote/BUILD.chrono-0.4.19.bazel +++ b/bazel/cargo/remote/BUILD.chrono-0.4.19.bazel @@ -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", @@ -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. # diff --git a/bazel/cargo/remote/BUILD.getrandom-0.2.2.bazel b/bazel/cargo/remote/BUILD.getrandom-0.2.2.bazel index 7c75595c..8f3c01c6 100644 --- a/bazel/cargo/remote/BUILD.getrandom-0.2.2.bazel +++ b/bazel/cargo/remote/BUILD.getrandom-0.2.2.bazel @@ -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", @@ -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. # @@ -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", diff --git a/bazel/cargo/remote/BUILD.hashbrown-0.9.1.bazel b/bazel/cargo/remote/BUILD.hashbrown-0.9.1.bazel index 72fbe248..348c8f38 100644 --- a/bazel/cargo/remote/BUILD.hashbrown-0.9.1.bazel +++ b/bazel/cargo/remote/BUILD.hashbrown-0.9.1.bazel @@ -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", @@ -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. # diff --git a/bazel/cargo/remote/BUILD.libc-0.2.88.bazel b/bazel/cargo/remote/BUILD.libc-0.2.88.bazel index 610522e1..ccf1612e 100644 --- a/bazel/cargo/remote/BUILD.libc-0.2.88.bazel +++ b/bazel/cargo/remote/BUILD.libc-0.2.88.bazel @@ -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", @@ -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. # @@ -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", diff --git a/bazel/cargo/remote/BUILD.log-0.4.14.bazel b/bazel/cargo/remote/BUILD.log-0.4.14.bazel index 2946014f..60912516 100644 --- a/bazel/cargo/remote/BUILD.log-0.4.14.bazel +++ b/bazel/cargo/remote/BUILD.log-0.4.14.bazel @@ -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", @@ -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. # @@ -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", diff --git a/bazel/cargo/remote/BUILD.num-integer-0.1.44.bazel b/bazel/cargo/remote/BUILD.num-integer-0.1.44.bazel index b2a2a986..26aa4162 100644 --- a/bazel/cargo/remote/BUILD.num-integer-0.1.44.bazel +++ b/bazel/cargo/remote/BUILD.num-integer-0.1.44.bazel @@ -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", @@ -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. # @@ -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", diff --git a/bazel/cargo/remote/BUILD.num-traits-0.2.14.bazel b/bazel/cargo/remote/BUILD.num-traits-0.2.14.bazel index debef725..f49065f7 100644 --- a/bazel/cargo/remote/BUILD.num-traits-0.2.14.bazel +++ b/bazel/cargo/remote/BUILD.num-traits-0.2.14.bazel @@ -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", @@ -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. # @@ -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", diff --git a/bazel/cargo/remote/BUILD.time-0.1.43.bazel b/bazel/cargo/remote/BUILD.time-0.1.43.bazel index 703bb9b0..88ee584f 100644 --- a/bazel/cargo/remote/BUILD.time-0.1.43.bazel +++ b/bazel/cargo/remote/BUILD.time-0.1.43.bazel @@ -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", @@ -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. # diff --git a/bazel/cargo/remote/BUILD.wasi-0.10.2+wasi-snapshot-preview1.bazel b/bazel/cargo/remote/BUILD.wasi-0.10.2+wasi-snapshot-preview1.bazel index dc3e3fef..d65930a5 100644 --- a/bazel/cargo/remote/BUILD.wasi-0.10.2+wasi-snapshot-preview1.bazel +++ b/bazel/cargo/remote/BUILD.wasi-0.10.2+wasi-snapshot-preview1.bazel @@ -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", @@ -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. # diff --git a/bazel/cargo/remote/BUILD.winapi-0.3.9.bazel b/bazel/cargo/remote/BUILD.winapi-0.3.9.bazel index f4a8eeed..4c7c4282 100644 --- a/bazel/cargo/remote/BUILD.winapi-0.3.9.bazel +++ b/bazel/cargo/remote/BUILD.winapi-0.3.9.bazel @@ -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", @@ -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. # @@ -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", diff --git a/bazel/cargo/remote/BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel b/bazel/cargo/remote/BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel index 7882e51b..e501d339 100644 --- a/bazel/cargo/remote/BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel +++ b/bazel/cargo/remote/BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel @@ -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", @@ -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. # @@ -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", diff --git a/bazel/cargo/remote/BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel b/bazel/cargo/remote/BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel index b061a534..5cf1d6c3 100644 --- a/bazel/cargo/remote/BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel +++ b/bazel/cargo/remote/BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel @@ -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", @@ -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. # @@ -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", diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 2e780b96..e616d4a1 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -13,9 +13,11 @@ # limitations under the License. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def proxy_wasm_rust_sdk_repositories(): - http_archive( + maybe( + http_archive, name = "rules_rust", sha256 = "f2d9f804e1a8042a41ad41e1aeeca55ad0fc2d294ecd52e34ef8c63f7ce350fd", strip_prefix = "rules_rust-3b02397bde43b1eeee1528227ceb3da6c6bdadd6",