Skip to content

Commit a66fc4f

Browse files
committed
Replace host_windows condition with @platforms//os:windows
Bazel 8 emits warnings for deprecated bazel_tools condition targets such as @bazel_tools//src/conditions:host_windows_x64_constraint. rules_nodejs still uses @bazel_tools//src/conditions:host_windows in a few widely used rules (e.g. js_library, npm_link, pkg_npm), causing consumers to see large numbers of warnings from generated npm targets. Replace these host Windows checks with @platforms//os:windows in the affected user-facing rules. This is a minimal change to eliminate the Bazel 8 warning flood without attempting a full migration of all bazel_tools condition usages. Architecture-specific and toolchain-selection cases are intentionally left unchanged, as they require a more careful migration. Fixes Bazel 8 warnings reported in #2440
1 parent fd7070c commit a66fc4f

6 files changed

Lines changed: 7 additions & 7 deletions

File tree

internal/common/copy_to_bin.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def copy_to_bin(name, srcs, **kwargs):
5858
name = name,
5959
srcs = srcs,
6060
is_windows = select({
61-
"@bazel_tools//src/conditions:host_windows": True,
61+
"@platforms//os:windows": True,
6262
"//conditions:default": False,
6363
}),
6464
**kwargs

internal/common/params_file.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def params_file(
125125
data = data,
126126
newline = newline or "auto",
127127
is_windows = select({
128-
"@bazel_tools//src/conditions:host_windows": True,
128+
"@platforms//os:windows": True,
129129
"//conditions:default": False,
130130
}),
131131
**kwargs

internal/js_library/js_library.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ def js_library(
417417
# TODO: remove once legacy module_mapping is removed
418418
module_name = package_name if package_name != "$node_modules$" else None,
419419
is_windows = select({
420-
"@bazel_tools//src/conditions:host_windows": True,
420+
"@platforms//os:windows": True,
421421
"//conditions:default": False,
422422
}),
423423
**kwargs

internal/linker/npm_link.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ set to the target's package & the files provided from the targets DefaultInfo.
151151
package_name = package_name,
152152
package_path = package_path,
153153
is_windows = select({
154-
"@bazel_tools//src/conditions:host_windows": True,
154+
"@platforms//os:windows": True,
155155
"//conditions:default": False,
156156
}),
157157
**kwargs

internal/pkg_npm/pkg_npm.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,15 +376,15 @@ def pkg_npm_macro(name, tgz = None, **kwargs):
376376
native.alias(
377377
name = name + ".pack",
378378
actual = select({
379-
"@bazel_tools//src/conditions:host_windows": name + ".pack.bat",
379+
"@platforms//os:windows": name + ".pack.bat",
380380
"//conditions:default": name + ".pack.sh",
381381
}),
382382
)
383383

384384
native.alias(
385385
name = name + ".publish",
386386
actual = select({
387-
"@bazel_tools//src/conditions:host_windows": name + ".publish.bat",
387+
"@platforms//os:windows": name + ".publish.bat",
388388
"//conditions:default": name + ".publish.sh",
389389
}),
390390
)

third_party/github.com/bazelbuild/bazel-skylib/rules/private/copy_file_private.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def copy_file(name, src, out, is_directory = False, is_executable = False, allow
203203
src = src,
204204
out = out,
205205
is_windows = select({
206-
"@bazel_tools//src/conditions:host_windows": True,
206+
"@platforms//os:windows": True,
207207
"//conditions:default": False,
208208
}),
209209
is_executable = is_executable,

0 commit comments

Comments
 (0)