Skip to content

Commit 5142290

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

File tree

5 files changed

+67
-19
lines changed

5 files changed

+67
-19
lines changed

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.0.9")
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+
"//tools:dummy_cc_toolchain_impl",
176168
)

packages/angular/ssr/BUILD.bazel

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
load("@devinfra//bazel/api-golden:index.bzl", "api_golden_test_npm_package")
22
load("@npm//:defs.bzl", "npm_link_all_packages")
3-
load("@rules_pkg//:pkg.bzl", "pkg_tar")
43
load("//tools:defaults.bzl", "ng_package", "ts_project")
54

65
package(default_visibility = ["//visibility:public"])
@@ -77,11 +76,11 @@ ng_package(
7776
],
7877
)
7978

80-
pkg_tar(
79+
genrule(
8180
name = "npm_package_archive",
8281
srcs = [":npm_package"],
83-
extension = "tgz",
84-
strip_prefix = "./npm_package",
82+
outs = ["npm_package_archive.tgz"],
83+
cmd = "tar -czf $@ -C $(location :npm_package) .",
8584
# should not be built unless it is a dependency of another rule
8685
tags = ["manual"],
8786
)

tools/BUILD.bazel

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
load("@rules_cc//cc:defs.bzl", "cc_toolchain")
12
load("//tools:defaults.bzl", "js_binary")
3+
load(":dummy_cc_toolchain.bzl", "dummy_cc_toolchain_config")
24

35
package(default_visibility = ["//visibility:public"])
46

@@ -30,3 +32,31 @@ js_binary(
3032
],
3133
entry_point = "quicktype_runner.js",
3234
)
35+
36+
dummy_cc_toolchain_config(name = "dummy_config")
37+
38+
filegroup(name = "empty")
39+
40+
cc_toolchain(
41+
name = "dummy_cc_toolchain",
42+
all_files = ":empty",
43+
compiler_files = ":empty",
44+
dwp_files = ":empty",
45+
linker_files = ":empty",
46+
objcopy_files = ":empty",
47+
strip_files = ":empty",
48+
supports_param_files = 0,
49+
toolchain_config = ":dummy_config",
50+
toolchain_identifier = "dummy-toolchain",
51+
)
52+
53+
toolchain(
54+
name = "dummy_cc_toolchain_impl",
55+
exec_compatible_with = [],
56+
target_compatible_with = [
57+
"@platforms//os:windows",
58+
"@platforms//cpu:x86_64",
59+
],
60+
toolchain = ":dummy_cc_toolchain",
61+
toolchain_type = "@rules_cc//cc:toolchain_type",
62+
)

tools/bazel/npm_package.bzl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ load("@aspect_bazel_lib//lib:expand_template.bzl", "expand_template")
33
load("@aspect_bazel_lib//lib:jq.bzl", "jq")
44
load("@aspect_bazel_lib//lib:utils.bzl", "to_label")
55
load("@aspect_rules_js//npm:defs.bzl", _npm_package = "npm_package")
6-
load("@rules_pkg//:pkg.bzl", "pkg_tar")
76
load("//tools:link_package_json_to_tarballs.bzl", "link_package_json_to_tarballs")
87
load("//tools:snapshot_repo_filter.bzl", "SNAPSHOT_REPO_JQ_FILTER")
98
load("//tools:substitutions.bzl", "substitutions")
@@ -115,10 +114,10 @@ def npm_package(
115114
)
116115

117116
if pkg_json:
118-
pkg_tar(
117+
native.genrule(
119118
name = "npm_package_archive",
120119
srcs = [":pkg"],
121-
extension = "tgz",
122-
strip_prefix = "./npm_package",
120+
outs = ["npm_package_archive.tgz"],
121+
cmd = "tar -czf $@ -C $(location :pkg) .",
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)