Skip to content

Commit a2e4fcb

Browse files
committed
[Bazel] Replace uses of deprecated @bazel_tools things
All C++ infrastructure should come from @rules_cc now. Also the `host_windows` constraint was deprecated a while ago and is being removed in Bazel 9.
1 parent c817c0c commit a2e4fcb

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

bazel/emscripten_toolchain/toolchain.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""This module encapsulates logic to create emscripten_cc_toolchain_config rule."""
22

3-
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
3+
load("@rules_cc//cc:action_names.bzl", "ACTION_NAMES")
44
load(
5-
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
5+
"@rules_cc//cc:cc_toolchain_config_lib.bzl",
66
"action_config",
77
"env_entry",
88
"env_set",

bazel/remote_emscripten_repository.bzl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
22
load("@rules_cc//cc:defs.bzl", "cc_toolchain", "cc_toolchain_suite")
33
load("//emscripten_toolchain:toolchain.bzl", "emscripten_cc_toolchain_config_rule", "emscripten_python_interpreter_files")
44
load(":emscripten_build_file.bzl", "EMSCRIPTEN_BUILD_FILE_CONTENT_TEMPLATE")
5+
load("@platforms//host:constraints.bzl", "HOST_CONSTRAINTS")
56

67
def remote_emscripten_repository(
78
name,
@@ -55,6 +56,10 @@ def create_toolchains(name, repo_name, exec_compatible_with):
5556
repo_linker_files_target = remote_repo + ":linker_files"
5657
repo_ar_files_target = remote_repo + ":ar_files"
5758

59+
script_extension = "sh"
60+
if "@platforms//os:windows" in HOST_CONSTRAINTS:
61+
script_extension = "bat"
62+
5863
emscripten_python_interpreter_files(
5964
name = python_interpreter_name,
6065
)
@@ -116,10 +121,7 @@ def create_toolchains(name, repo_name, exec_compatible_with):
116121
em_config = "@emscripten_cache//:emscripten_config",
117122
emscripten_binaries = repo_compiler_files_target,
118123
nodejs_bin = "@nodejs//:node",
119-
script_extension = select({
120-
"@bazel_tools//src/conditions:host_windows": "bat",
121-
"//conditions:default": "sh",
122-
}),
124+
script_extension = script_extension,
123125
)
124126

125127
cc_toolchain(
@@ -141,7 +143,7 @@ def create_toolchains(name, repo_name, exec_compatible_with):
141143
target_compatible_with = ["@platforms//cpu:wasm32"],
142144
exec_compatible_with = exec_compatible_with,
143145
toolchain = cc_wasm_target,
144-
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
146+
toolchain_type = "@rules_cc//cc:toolchain_type",
145147
)
146148

147149
cc_toolchain_suite(

0 commit comments

Comments
 (0)