diff --git a/MODULE.bazel b/MODULE.bazel index 517b1be08a9a0..2b37489f18913 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -19,6 +19,7 @@ bazel_dep(name = "rules_pkg", version = "0.9.1") bazel_dep(name = "rules_python", version = "0.31.0") bazel_dep(name = "rules_proto", version = "5.3.0-21.7") bazel_dep(name = "rules_ruby", version = "0.8.1") +bazel_dep(name = "rules_rust", version = "0.41.1") linter = use_extension("@apple_rules_lint//lint:extensions.bzl", "linter") linter.configure( @@ -321,6 +322,21 @@ use_repo(ruby, "bundle", "ruby", "ruby_toolchains") register_toolchains("@ruby_toolchains//:all") +rust = use_extension("@rules_rust//rust:extensions.bzl", "rust") +rust.toolchain( + edition = "2021", + versions = ["1.76.0"], +) +use_repo(rust, "rust_toolchains") + +crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate") +crate.from_cargo( + name = "crates", + cargo_lockfile = "//rust:Cargo.lock", + manifests = ["//rust:Cargo.toml"], +) +use_repo(crate, "crates") + selenium_manager_artifacts = use_extension("//common:selenium_manager.bzl", "selenium_manager_artifacts") use_repo( selenium_manager_artifacts, diff --git a/WORKSPACE b/WORKSPACE index 10735ec3d3edd..aea396c789541 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -10,39 +10,6 @@ rules_proto_dependencies() rules_proto_toolchains() -# Move to MODULE.bazel once a new release is out with -# https://github.com/bazelbuild/rules_rust/commit/fc601ba32f21ec034baebc487646dea92afbcd04. - -http_archive( - name = "rules_rust", - integrity = "sha256-XT1YVJ6FHJTXBr1v3px2fV37/OCS3dQk3ul+XvfIIf8=", - urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.42.0/rules_rust-v0.42.0.tar.gz"], -) - -load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains") - -rules_rust_dependencies() - -rust_register_toolchains( - edition = "2021", - versions = [ - "1.77.0", - ], -) - -load("@rules_rust//crate_universe:defs.bzl", "crates_repository") - -crates_repository( - name = "crates", - cargo_lockfile = "//rust:Cargo.lock", - lockfile = "//rust:Cargo.Bazel.lock", - manifests = ["//rust:Cargo.toml"], -) - -load("@crates//:defs.bzl", "crate_repositories") - -crate_repositories() - # rules_closure are not published to BCR. http_archive(