Skip to content

Commit dfa3a5c

Browse files
committed
fixup! build: update to bazel version 8.4.2
1 parent a000925 commit dfa3a5c

File tree

7 files changed

+66
-20
lines changed

7 files changed

+66
-20
lines changed

BUILD.bazel

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ load("@aspect_rules_ts//ts:defs.bzl", rules_js_tsconfig = "ts_config")
22
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
33
load("@devinfra//bazel/validation:defs.bzl", "validate_ts_version_matching")
44
load("@npm//:defs.bzl", "npm_link_all_packages")
5+
load("@rules_cc//cc:defs.bzl", "cc_toolchain")
56
load("//tools:defaults.bzl", "copy_to_bin")
7+
load("//tools:dummy_cc_toolchain.bzl", "dummy_cc_toolchain_config")
68

79
package(default_visibility = ["//visibility:public"])
810

@@ -111,7 +113,7 @@ validate_ts_version_matching(
111113

112114
# This is needed following https://github.com/bazel-contrib/rules_nodejs/pull/3859
113115
toolchain(
114-
name = "node22_windows_no_exec_config_toolchain",
116+
name = "node22_windows_no_exec_toolchain",
115117
exec_compatible_with = [],
116118
target_compatible_with = [
117119
"@platforms//os:windows",
@@ -120,3 +122,33 @@ toolchain(
120122
toolchain = "@node22_windows_amd64//:toolchain",
121123
toolchain_type = "@rules_nodejs//nodejs:toolchain_type",
122124
)
125+
126+
# This defines a dummy C++ toolchain for Windows.
127+
# Without this, the build fails with "Unable to find a CC toolchain using toolchain resolution".
128+
dummy_cc_toolchain_config(name = "dummy_cc_toolchain_config")
129+
130+
filegroup(name = "empty")
131+
132+
cc_toolchain(
133+
name = "dummy_cc_toolchain",
134+
all_files = ":empty",
135+
compiler_files = ":empty",
136+
dwp_files = ":empty",
137+
linker_files = ":empty",
138+
objcopy_files = ":empty",
139+
strip_files = ":empty",
140+
supports_param_files = 0,
141+
toolchain_config = ":dummy_cc_toolchain_config",
142+
toolchain_identifier = "dummy_cc_toolchain",
143+
)
144+
145+
toolchain(
146+
name = "dummy_cc_windows_no_exec_toolchain",
147+
exec_compatible_with = [],
148+
target_compatible_with = [
149+
"@platforms//os:windows",
150+
"@platforms//cpu:x86_64",
151+
],
152+
toolchain = ":dummy_cc_toolchain",
153+
toolchain_type = "@rules_cc//cc:toolchain_type",
154+
)

MODULE.bazel

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,8 @@ bazel_dep(name = "yq.bzl", version = "0.3.2")
99
bazel_dep(name = "rules_nodejs", version = "6.6.2")
1010
bazel_dep(name = "aspect_rules_js", version = "2.8.3")
1111
bazel_dep(name = "aspect_rules_ts", version = "3.7.1")
12-
bazel_dep(name = "rules_pkg", version = "0.8.1")
13-
14-
# Alow for usage of rules_pkg@0.8.1 even though other deps want a later verison.
15-
multiple_version_override(
16-
module_name = "rules_pkg",
17-
versions = [
18-
"0.8.1",
19-
"1.1.0",
20-
],
21-
)
22-
12+
bazel_dep(name = "rules_pkg", version = "1.1.0")
13+
bazel_dep(name = "rules_cc", version = "0.1.1")
2314
bazel_dep(name = "aspect_bazel_lib", version = "2.22.0")
2415
bazel_dep(name = "bazel_skylib", version = "1.8.2")
2516
bazel_dep(name = "aspect_rules_esbuild", version = "0.24.0")
@@ -105,9 +96,6 @@ use_repo(
10596
"node24_windows_amd64",
10697
)
10798

108-
# This is needed following https://github.com/bazel-contrib/rules_nodejs/pull/3859
109-
register_toolchains("//:node22_windows_no_exec_config_toolchain")
110-
11199
npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
112100
npm.npm_translate_lock(
113101
name = "npm",
@@ -173,4 +161,6 @@ register_toolchains(
173161
"@devinfra//bazel/git-toolchain:git_macos_x86_toolchain",
174162
"@devinfra//bazel/git-toolchain:git_macos_arm64_toolchain",
175163
"@devinfra//bazel/git-toolchain:git_windows_toolchain",
164+
"//:dummy_cc_windows_no_exec_toolchain",
165+
"//:node22_windows_no_exec_toolchain",
176166
)

MODULE.bazel.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/angular/ssr/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ pkg_tar(
8181
name = "npm_package_archive",
8282
srcs = [":npm_package"],
8383
extension = "tgz",
84-
strip_prefix = "./npm_package",
8584
# should not be built unless it is a dependency of another rule
8685
tags = ["manual"],
8786
)

tests/legacy-cli/e2e_runner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ async function findPackageTars(): Promise<{ [pkg: string]: PkgInfo }> {
403403
);
404404

405405
const pkgJsons = await Promise.all(
406-
pkgs.map((pkg) => realpathSync(pkg)).map((pkg) => extractFile(pkg, './package.json')),
406+
pkgs.map((pkg) => realpathSync(pkg)).map((pkg) => extractFile(pkg, 'npm_package/package.json')),
407407
);
408408

409409
return pkgs.reduce(

tools/bazel/npm_package.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,5 @@ def npm_package(
119119
name = "npm_package_archive",
120120
srcs = [":pkg"],
121121
extension = "tgz",
122-
strip_prefix = "./npm_package",
123122
visibility = visibility,
124123
)

tools/dummy_cc_toolchain.bzl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""
2+
This file defines a dummy C++ toolchain for Windows.
3+
It is needed to satisfy Bazel's toolchain resolution when cross-compiling for Windows on Linux.
4+
Some rules (e.g. rules_nodejs, js_test) or their dependencies may trigger C++ toolchain resolution
5+
even if no actual C++ compilation is performed for the target platform.
6+
Without this, the build fails with "Unable to find a CC toolchain using toolchain resolution".
7+
"""
8+
9+
load("@rules_cc//cc:defs.bzl", "cc_common")
10+
11+
def _impl(ctx):
12+
return cc_common.create_cc_toolchain_config_info(
13+
ctx = ctx,
14+
toolchain_identifier = "dummy-toolchain",
15+
host_system_name = "local",
16+
target_system_name = "local",
17+
target_cpu = "x64_windows",
18+
target_libc = "unknown",
19+
compiler = "dummy",
20+
abi_version = "unknown",
21+
abi_libc_version = "unknown",
22+
)
23+
24+
dummy_cc_toolchain_config = rule(
25+
implementation = _impl,
26+
attrs = {},
27+
provides = [CcToolchainConfigInfo],
28+
)

0 commit comments

Comments
 (0)