diff --git a/WORKSPACE b/WORKSPACE index ca8cee2dc5..4e4159d6fa 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -72,7 +72,7 @@ nodejs_register_toolchains( nodejs_register_toolchains( name = "node15", - node_version = "15.14.0", + node_version = "16.5.0", ) load("@build_bazel_rules_nodejs//:npm_deps.bzl", "npm_deps") diff --git a/e2e/core/BUILD.bazel b/e2e/core/BUILD.bazel index cdae503ce3..b541605027 100644 --- a/e2e/core/BUILD.bazel +++ b/e2e/core/BUILD.bazel @@ -22,13 +22,13 @@ write_file( # alias( # name = "node_bin", # actual = select({ -# "@bazel_tools//src/conditions:darwin_arm64": "@node16_darwin_arm64//:node_bin", -# "@bazel_tools//src/conditions:darwin_x86_64": "@node16_darwin_amd64//:node_bin", -# "@bazel_tools//src/conditions:linux_aarch64": "@node16_linux_arm64//:node_bin", -# "@bazel_tools//src/conditions:linux_s390x": "@node16_linux_s390x//:node_bin", -# "@bazel_tools//src/conditions:linux_x86_64": "@node16_linux_amd64//:node_bin", -# "@bazel_tools//src/conditions:linux_ppc64le": "@node16_linux_ppc64le//:node_bin", -# "@bazel_tools//src/conditions:windows": "@node16_windows_amd64//:node_bin", +# "@rules_nodejs//nodejs:is_darwin_arm64": "@node16_darwin_arm64//:node_bin", +# "@rules_nodejs//nodejs:is_darwin_amd64": "@node16_darwin_amd64//:node_bin", +# "@rules_nodejs//nodejs:is_linux_arm64": "@node16_linux_arm64//:node_bin", +# "@rules_nodejs//nodejs:is_linux_s390x": "@node16_linux_s390x//:node_bin", +# "@rules_nodejs//nodejs:is_linux_amd64": "@node16_linux_amd64//:node_bin", +# "@rules_nodejs//nodejs:is_linux_ppc64le": "@node16_linux_ppc64le//:node_bin", +# "@rules_nodejs//nodejs:is_windows_amd64": "@node16_windows_amd64//:node_bin", # "//conditions:default": "@node16_linux_amd64//:node_bin", # }), # ) @@ -213,9 +213,9 @@ my_nodejs( # using the select statement will download toolchains for all three platforms # you can also just provide an individual toolchain if you don't want to download them all toolchain = select({ - "@bazel_tools//src/conditions:linux_x86_64": "@node15_linux_amd64//:node_toolchain", - "@bazel_tools//src/conditions:darwin": "@node15_darwin_amd64//:node_toolchain", - "@bazel_tools//src/conditions:windows": "@node15_windows_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_linux_amd64": "@node15_linux_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_darwin_amd64": "@node15_darwin_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_windows_amd64": "@node15_windows_amd64//:node_toolchain", }), ) @@ -233,9 +233,9 @@ my_nodejs( # using the select statement will download toolchains for all three platforms # you can also just provide an individual toolchain if you don't want to download them all toolchain = select({ - "@bazel_tools//src/conditions:linux_x86_64": "@node16_linux_amd64//:node_toolchain", - "@bazel_tools//src/conditions:darwin": "@node16_darwin_amd64//:node_toolchain", - "@bazel_tools//src/conditions:windows": "@node16_windows_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_linux_amd64": "@node16_linux_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_darwin_amd64": "@node16_darwin_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_windows_amd64": "@node16_windows_amd64//:node_toolchain", }), ) diff --git a/internal/common/copy_to_bin.bzl b/internal/common/copy_to_bin.bzl index 88ce33e541..fd99f23747 100644 --- a/internal/common/copy_to_bin.bzl +++ b/internal/common/copy_to_bin.bzl @@ -58,7 +58,7 @@ def copy_to_bin(name, srcs, **kwargs): name = name, srcs = srcs, is_windows = select({ - "@bazel_tools//src/conditions:host_windows": True, + "@rules_nodejs//nodejs:is_windows_amd64": True, "//conditions:default": False, }), **kwargs diff --git a/internal/common/params_file.bzl b/internal/common/params_file.bzl index 7a3ee6c79d..16798680ce 100644 --- a/internal/common/params_file.bzl +++ b/internal/common/params_file.bzl @@ -125,7 +125,7 @@ def params_file( data = data, newline = newline or "auto", is_windows = select({ - "@bazel_tools//src/conditions:host_windows": True, + "@rules_nodejs//nodejs:is_windows_amd64": True, "//conditions:default": False, }), **kwargs diff --git a/internal/js_library/js_library.bzl b/internal/js_library/js_library.bzl index 0a296c04cf..70a5e7f8bf 100644 --- a/internal/js_library/js_library.bzl +++ b/internal/js_library/js_library.bzl @@ -445,7 +445,7 @@ def js_library( # TODO: remove once legacy module_mapping is removed module_name = package_name if package_name != "$node_modules$" and package_name != "$node_modules_dir$" else None, is_windows = select({ - "@bazel_tools//src/conditions:host_windows": True, + "@rules_nodejs//nodejs:is_windows_amd64": True, "//conditions:default": False, }), **kwargs diff --git a/internal/linker/npm_link.bzl b/internal/linker/npm_link.bzl index 35b33fdc1e..4723881017 100644 --- a/internal/linker/npm_link.bzl +++ b/internal/linker/npm_link.bzl @@ -148,7 +148,7 @@ set to the target's package & the files provided from the targets DefaultInfo. package_name = package_name, package_path = package_path, is_windows = select({ - "@bazel_tools//src/conditions:host_windows": True, + "@rules_nodejs//nodejs:is_windows_amd64": True, "//conditions:default": False, }), **kwargs diff --git a/internal/node/test/BUILD.bazel b/internal/node/test/BUILD.bazel index f0f465bb66..96d44c940b 100644 --- a/internal/node/test/BUILD.bazel +++ b/internal/node/test/BUILD.bazel @@ -558,9 +558,9 @@ nodejs_binary( # using the select statement will download toolchains for all three platforms # you can also just provide an individual toolchain if you don't want to download them all toolchain = select({ - "@bazel_tools//src/conditions:linux_x86_64": "@node15_linux_amd64//:node_toolchain", - "@bazel_tools//src/conditions:darwin": "@node15_darwin_amd64//:node_toolchain", - "@bazel_tools//src/conditions:windows": "@node15_windows_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_linux_amd64": "@node15_linux_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_darwin_amd64": "@node15_darwin_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_windows_amd64": "@node15_windows_amd64//:node_toolchain", }), ) @@ -570,9 +570,9 @@ nodejs_binary( # using the select statement will download toolchains for all three platforms # you can also just provide an individual toolchain if you don't want to download them all toolchain = select({ - "@bazel_tools//src/conditions:linux_x86_64": "@node16_linux_amd64//:node_toolchain", - "@bazel_tools//src/conditions:darwin": "@node16_darwin_amd64//:node_toolchain", - "@bazel_tools//src/conditions:windows": "@node16_windows_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_linux_amd64": "@node16_linux_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_darwin_amd64": "@node16_darwin_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_windows_amd64": "@node16_windows_amd64//:node_toolchain", }), ) @@ -587,9 +587,9 @@ nodejs_test( # using the select statement will download toolchains for all three platforms # you can also just provide an individual toolchain if you don't want to download them all toolchain = select({ - "@bazel_tools//src/conditions:linux_x86_64": "@node15_linux_amd64//:node_toolchain", - "@bazel_tools//src/conditions:darwin": "@node15_darwin_amd64//:node_toolchain", - "@bazel_tools//src/conditions:windows": "@node15_windows_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_linux_amd64": "@node15_linux_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_darwin_amd64": "@node15_darwin_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_windows_amd64": "@node15_windows_amd64//:node_toolchain", }), ) @@ -599,9 +599,9 @@ nodejs_test( # using the select statement will download toolchains for all three platforms # you can also just provide an individual toolchain if you don't want to download them all toolchain = select({ - "@bazel_tools//src/conditions:linux_x86_64": "@node16_linux_amd64//:node_toolchain", - "@bazel_tools//src/conditions:darwin": "@node16_darwin_amd64//:node_toolchain", - "@bazel_tools//src/conditions:windows": "@node16_windows_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_linux_amd64": "@node16_linux_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_darwin_amd64": "@node16_darwin_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_windows_amd64": "@node16_windows_amd64//:node_toolchain", }), ) @@ -626,14 +626,14 @@ nodejs_test( # using the select statement will download toolchains for all platforms # you can also just provide an individual toolchain if you don't want to download them all select({ - "@bazel_tools//src/conditions:linux_x86_64": "@node16_linux_amd64//:node_toolchain", - "@bazel_tools//src/conditions:darwin": "@node16_darwin_amd64//:node_toolchain", - "@bazel_tools//src/conditions:windows": "@node16_windows_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_linux_amd64": "@node16_linux_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_darwin_amd64": "@node16_darwin_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_windows_amd64": "@node16_windows_amd64//:node_toolchain", }), select({ - "@bazel_tools//src/conditions:linux_x86_64": "@node15_linux_amd64//:node_toolchain", - "@bazel_tools//src/conditions:darwin": "@node15_darwin_amd64//:node_toolchain", - "@bazel_tools//src/conditions:windows": "@node15_windows_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_linux_amd64": "@node15_linux_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_darwin_amd64": "@node15_darwin_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_windows_amd64": "@node15_windows_amd64//:node_toolchain", }), ], ) @@ -661,14 +661,14 @@ nodejs_test( # using the select statement will download toolchains for all platforms # you can also just provide an individual toolchain if you don't want to download them all select({ - "@bazel_tools//src/conditions:linux_x86_64": "@node16_linux_amd64//:node_toolchain", - "@bazel_tools//src/conditions:darwin": "@node16_darwin_amd64//:node_toolchain", - "@bazel_tools//src/conditions:windows": "@node16_windows_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_linux_amd64": "@node16_linux_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_darwin_amd64": "@node16_darwin_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_windows_amd64": "@node16_windows_amd64//:node_toolchain", }), select({ - "@bazel_tools//src/conditions:linux_x86_64": "@node15_linux_amd64//:node_toolchain", - "@bazel_tools//src/conditions:darwin": "@node15_darwin_amd64//:node_toolchain", - "@bazel_tools//src/conditions:windows": "@node15_windows_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_linux_amd64": "@node15_linux_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_darwin_amd64": "@node15_darwin_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_windows_amd64": "@node15_windows_amd64//:node_toolchain", }), ], ) @@ -697,14 +697,14 @@ nodejs_test( # using the select statement will download toolchains for all platforms # you can also just provide an individual toolchain if you don't want to download them all select({ - "@bazel_tools//src/conditions:linux_x86_64": "@node16_linux_amd64//:node_toolchain", - "@bazel_tools//src/conditions:darwin": "@node16_darwin_amd64//:node_toolchain", - "@bazel_tools//src/conditions:windows": "@node16_windows_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_linux_amd64": "@node16_linux_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_darwin_amd64": "@node16_darwin_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_windows_amd64": "@node16_windows_amd64//:node_toolchain", }), select({ - "@bazel_tools//src/conditions:linux_x86_64": "@node15_linux_amd64//:node_toolchain", - "@bazel_tools//src/conditions:darwin": "@node15_darwin_amd64//:node_toolchain", - "@bazel_tools//src/conditions:windows": "@node15_windows_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_linux_amd64": "@node15_linux_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_darwin_amd64": "@node15_darwin_amd64//:node_toolchain", + "@rules_nodejs//nodejs:is_windows_amd64": "@node15_windows_amd64//:node_toolchain", }), ], ) diff --git a/internal/pkg_npm/pkg_npm.bzl b/internal/pkg_npm/pkg_npm.bzl index ac2d9057ab..b92e6ab144 100644 --- a/internal/pkg_npm/pkg_npm.bzl +++ b/internal/pkg_npm/pkg_npm.bzl @@ -380,7 +380,7 @@ def pkg_npm_macro(name, tgz = None, **kwargs): native.alias( name = name + ".pack", actual = select({ - "@bazel_tools//src/conditions:host_windows": name + ".pack.bat", + "@rules_nodejs//nodejs:is_windows_amd64": name + ".pack.bat", "//conditions:default": name + ".pack.sh", }), ) @@ -388,7 +388,7 @@ def pkg_npm_macro(name, tgz = None, **kwargs): native.alias( name = name + ".publish", actual = select({ - "@bazel_tools//src/conditions:host_windows": name + ".publish.bat", + "@rules_nodejs//nodejs:is_windows_amd64": name + ".publish.bat", "//conditions:default": name + ".publish.sh", }), ) diff --git a/nodejs/BUILD.bazel b/nodejs/BUILD.bazel index ddef6c8e90..a712f2ea50 100644 --- a/nodejs/BUILD.bazel +++ b/nodejs/BUILD.bazel @@ -36,3 +36,11 @@ toolchain_type( ) for key, values in PLATFORMS.items() ] + +[ + config_setting( + name = "is_%s" % key, + constraint_values = values.compatible_with, + ) + for key, values in PLATFORMS.items() +] diff --git a/third_party/github.com/bazelbuild/bazel-skylib/rules/private/copy_file_private.bzl b/third_party/github.com/bazelbuild/bazel-skylib/rules/private/copy_file_private.bzl index 307242d881..4c024eba01 100644 --- a/third_party/github.com/bazelbuild/bazel-skylib/rules/private/copy_file_private.bzl +++ b/third_party/github.com/bazelbuild/bazel-skylib/rules/private/copy_file_private.bzl @@ -209,7 +209,7 @@ def copy_file(name, src, out, is_directory = False, is_executable = False, allow src = src, out = out, is_windows = select({ - "@bazel_tools//src/conditions:host_windows": True, + "@rules_nodejs//nodejs:is_windows_amd64": True, "//conditions:default": False, }), is_executable = is_executable, diff --git a/third_party/github.com/bazelbuild/bazel-skylib/rules/private/write_file_private.bzl b/third_party/github.com/bazelbuild/bazel-skylib/rules/private/write_file_private.bzl index a5a69ae72d..697f07273e 100644 --- a/third_party/github.com/bazelbuild/bazel-skylib/rules/private/write_file_private.bzl +++ b/third_party/github.com/bazelbuild/bazel-skylib/rules/private/write_file_private.bzl @@ -95,7 +95,7 @@ def write_file( out = out, newline = newline or "auto", is_windows = select({ - "@bazel_tools//src/conditions:host_windows": True, + "@rules_nodejs//nodejs:is_windows_amd64": True, "//conditions:default": False, }), **kwargs @@ -107,7 +107,7 @@ def write_file( out = out, newline = newline or "auto", is_windows = select({ - "@bazel_tools//src/conditions:host_windows": True, + "@rules_nodejs//nodejs:is_windows_amd64": True, "//conditions:default": False, }), **kwargs diff --git a/toolchains/cypress/BUILD.bazel b/toolchains/cypress/BUILD.bazel index 1d59a2f043..8ec1d7eeec 100644 --- a/toolchains/cypress/BUILD.bazel +++ b/toolchains/cypress/BUILD.bazel @@ -38,10 +38,10 @@ toolchain_type(name = "toolchain_type") alias( name = "toolchain", actual = select({ - "@bazel_tools//src/conditions:darwin_x86_64": ":cypress_darwin_toolchain_config", - "@bazel_tools//src/conditions:darwin_arm64": ":cypress_darwin_arm64_toolchain_config", - "@bazel_tools//src/conditions:linux_x86_64": ":cypress_linux_toolchain_config", - "@bazel_tools//src/conditions:windows": ":cypress_windows_toolchain_config", + "@rules_nodejs//nodejs:is_darwin_amd64": ":cypress_darwin_toolchain_config", + "@rules_nodejs//nodejs:is_darwin_arm64": ":cypress_darwin_arm64_toolchain_config", + "@rules_nodejs//nodejs:is_linux_amd64": ":cypress_linux_toolchain_config", + "@rules_nodejs//nodejs:is_windows_amd64": ":cypress_windows_toolchain_config", "//conditions:default": ":cypress_linux_toolchain_config", }), visibility = ["//visibility:public"], @@ -51,10 +51,10 @@ alias( alias( name = "cypress_bin", actual = select({ - "@bazel_tools//src/conditions:darwin_x86_64": "@cypress_darwin//:bin", - "@bazel_tools//src/conditions:darwin_arm64": "@cypress_darwin_arm64//:bin", - "@bazel_tools//src/conditions:linux_x86_64": "@cypress_linux//:bin", - "@bazel_tools//src/conditions:windows": "@cypress_windows//:bin", + "@rules_nodejs//nodejs:is_darwin_amd64": "@cypress_darwin//:bin", + "@rules_nodejs//nodejs:is_darwin_arm64": "@cypress_darwin_arm64//:bin", + "@rules_nodejs//nodejs:is_linux_amd64": "@cypress_linux//:bin", + "@rules_nodejs//nodejs:is_windows_amd64": "@cypress_windows//:bin", "//conditions:default": "@cypress_linux//:bin", }), visibility = ["//visibility:public"], diff --git a/toolchains/esbuild/esbuild_repositories.bzl b/toolchains/esbuild/esbuild_repositories.bzl index 8d3a0fc1b7..bcdadf712c 100644 --- a/toolchains/esbuild/esbuild_repositories.bzl +++ b/toolchains/esbuild/esbuild_repositories.bzl @@ -31,7 +31,7 @@ def esbuild_repositories(name = "", npm_repository = "npm", npm_args = []): npm_args: additional args to pass to the npm install rule """ - _maybe( + maybe( http_archive, name = "bazel_skylib", sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d", diff --git a/toolchains/node/BUILD.bazel b/toolchains/node/BUILD.bazel index 300d40bd98..e4e352906f 100644 --- a/toolchains/node/BUILD.bazel +++ b/toolchains/node/BUILD.bazel @@ -40,13 +40,13 @@ toolchain_type( alias( name = "toolchain", actual = select({ - "@bazel_tools//src/conditions:darwin_arm64": "@nodejs_darwin_arm64_config//:toolchain", - "@bazel_tools//src/conditions:darwin_x86_64": "@nodejs_darwin_amd64_config//:toolchain", - "@bazel_tools//src/conditions:linux_aarch64": "@nodejs_linux_arm64_config//:toolchain", - "@bazel_tools//src/conditions:linux_s390x": "@nodejs_linux_s390x_config//:toolchain", - "@bazel_tools//src/conditions:linux_x86_64": "@nodejs_linux_amd64_config//:toolchain", - "@bazel_tools//src/conditions:windows": "@nodejs_windows_amd64_config//:toolchain", - "@bazel_tools//src/conditions:linux_ppc64le": "@nodejs_linux_ppc64le_config//:toolchain", + "@rules_nodejs//nodejs:is_darwin_arm64": "@nodejs_darwin_arm64_config//:toolchain", + "@rules_nodejs//nodejs:is_darwin_amd64": "@nodejs_darwin_amd64_config//:toolchain", + "@rules_nodejs//nodejs:is_linux_arm64": "@nodejs_linux_arm64_config//:toolchain", + "@rules_nodejs//nodejs:is_linux_s390x": "@nodejs_linux_s390x_config//:toolchain", + "@rules_nodejs//nodejs:is_linux_amd64": "@nodejs_linux_amd64_config//:toolchain", + "@rules_nodejs//nodejs:is_windows_amd64": "@nodejs_windows_amd64_config//:toolchain", + "@rules_nodejs//nodejs:is_linux_ppc64le": "@nodejs_linux_ppc64le_config//:toolchain", "//conditions:default": "@nodejs_linux_amd64_config//:toolchain", }), visibility = ["//visibility:public"], @@ -56,13 +56,13 @@ alias( alias( name = "node_bin", actual = select({ - "@bazel_tools//src/conditions:darwin_arm64": "@nodejs_darwin_arm64//:node_bin", - "@bazel_tools//src/conditions:darwin_x86_64": "@nodejs_darwin_amd64//:node_bin", - "@bazel_tools//src/conditions:linux_aarch64": "@nodejs_linux_arm64//:node_bin", - "@bazel_tools//src/conditions:linux_s390x": "@nodejs_linux_s390x//:node_bin", - "@bazel_tools//src/conditions:linux_x86_64": "@nodejs_linux_amd64//:node_bin", - "@bazel_tools//src/conditions:linux_ppc64le": "@nodejs_linux_ppc64le//:node_bin", - "@bazel_tools//src/conditions:windows": "@nodejs_windows_amd64//:node_bin", + "@rules_nodejs//nodejs:is_darwin_arm64": "@nodejs_darwin_arm64//:node_bin", + "@rules_nodejs//nodejs:is_darwin_amd64": "@nodejs_darwin_amd64//:node_bin", + "@rules_nodejs//nodejs:is_linux_arm64": "@nodejs_linux_arm64//:node_bin", + "@rules_nodejs//nodejs:is_linux_s390x": "@nodejs_linux_s390x//:node_bin", + "@rules_nodejs//nodejs:is_linux_amd64": "@nodejs_linux_amd64//:node_bin", + "@rules_nodejs//nodejs:is_linux_ppc64le": "@nodejs_linux_ppc64le//:node_bin", + "@rules_nodejs//nodejs:is_windows_amd64": "@nodejs_windows_amd64//:node_bin", "//conditions:default": "@nodejs_linux_amd64//:node_bin", }), visibility = ["//visibility:public"],