Skip to content

Commit 27f7d8d

Browse files
committed
Migrate C++ toolchains to bzlmod
For unknown reasons this behaves better with toolchain resolution and unbreaks the Bazel build on Windows.
1 parent 34f0aa0 commit 27f7d8d

File tree

3 files changed

+19
-25
lines changed

3 files changed

+19
-25
lines changed

.bazelrc

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
build --enable_bzlmod
16+
1517
# Use the earliest supported C++ version for protoc.
1618
build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14
1719

MODULE.bazel

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module(
2+
name = "nativelink",
3+
version = "0.0.0",
4+
compatibility_level = 0,
5+
)
6+
7+
register_execution_platforms(
8+
"@nativelink//local-remote-execution/generated/config:platform",
9+
)
10+
11+
register_toolchains(
12+
"@nativelink//local-remote-execution/generated/config:cc-toolchain",
13+
"@nativelink//local-remote-execution/generated/java:all",
14+
)
15+
16+
bazel_dep(name = "platforms", version = "0.0.8")
17+
bazel_dep(name = "rules_cc", version = "0.0.9")

WORKSPACE.bazel

-25
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,6 @@ workspace(name = "nativelink")
22

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

5-
http_archive(
6-
name = "rules_cc",
7-
sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf",
8-
strip_prefix = "rules_cc-0.0.9",
9-
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"],
10-
)
11-
12-
register_execution_platforms(
13-
"@nativelink//local-remote-execution/generated/config:platform",
14-
)
15-
16-
register_toolchains(
17-
"@nativelink//local-remote-execution/generated/config:cc-toolchain",
18-
"@nativelink//local-remote-execution/generated/java:all",
19-
)
20-
215
http_archive(
226
name = "rules_rust",
237
sha256 = "36ab8f9facae745c9c9c1b33d225623d976e78f2cc3f729b7973d8c20934ab95",
@@ -26,15 +10,6 @@ http_archive(
2610
],
2711
)
2812

29-
http_archive(
30-
name = "rules_python",
31-
sha256 = "84aec9e21cc56fbc7f1335035a71c850d1b9b5cc6ff497306f84cced9a769841",
32-
strip_prefix = "rules_python-0.23.1",
33-
urls = [
34-
"https://github.com/bazelbuild/rules_python/releases/download/0.23.1/rules_python-0.23.1.tar.gz",
35-
],
36-
)
37-
3813
load(
3914
"@rules_rust//rust:repositories.bzl",
4015
"rules_rust_dependencies",

0 commit comments

Comments
 (0)