@@ -2,6 +2,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
22load ("@rules_cc//cc:defs.bzl" , "cc_toolchain" , "cc_toolchain_suite" )
33load ("//emscripten_toolchain:toolchain.bzl" , "emscripten_cc_toolchain_config_rule" , "emscripten_python_interpreter_files" )
44load (":emscripten_build_file.bzl" , "EMSCRIPTEN_BUILD_FILE_CONTENT_TEMPLATE" )
5+ load ("@platforms//host:constraints.bzl" , "HOST_CONSTRAINTS" )
56
67def 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