Skip to content

Commit f6c94e7

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

File tree

6 files changed

+62
-14
lines changed

6 files changed

+62
-14
lines changed

BUILD.bazel

Lines changed: 30 additions & 0 deletions
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

@@ -120,3 +122,31 @@ toolchain(
120122
toolchain = "@node22_windows_amd64//:toolchain",
121123
toolchain_type = "@rules_nodejs//nodejs:toolchain_type",
122124
)
125+
126+
# This file 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_config")
129+
130+
cc_toolchain(
131+
name = "dummy_cc_toolchain",
132+
all_files = ":empty",
133+
compiler_files = ":empty",
134+
dwp_files = ":empty",
135+
linker_files = ":empty",
136+
objcopy_files = ":empty",
137+
strip_files = ":empty",
138+
supports_param_files = 0,
139+
toolchain_config = ":dummy_config",
140+
toolchain_identifier = "dummy-toolchain",
141+
)
142+
143+
toolchain(
144+
name = "dummy_cc_toolchain_impl",
145+
exec_compatible_with = [],
146+
target_compatible_with = [
147+
"@platforms//os:windows",
148+
"@platforms//cpu:x86_64",
149+
],
150+
toolchain = ":dummy_cc_toolchain",
151+
toolchain_type = "@rules_cc//cc:toolchain_type",
152+
)

MODULE.bazel

Lines changed: 3 additions & 11 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")
@@ -173,4 +164,5 @@ register_toolchains(
173164
"@devinfra//bazel/git-toolchain:git_macos_x86_toolchain",
174165
"@devinfra//bazel/git-toolchain:git_macos_arm64_toolchain",
175166
"@devinfra//bazel/git-toolchain:git_windows_toolchain",
167+
"//:dummy_cc_toolchain_impl",
176168
)

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)