From 2a2e29f1a536ea1a32f995bccbc3ae02d3fbd8ce Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Sat, 30 Mar 2024 18:00:05 -0400 Subject: [PATCH] refactor: remove unused run_npm from NodeInfo provider (#3725) --- docs/Core.md | 8 +------- nodejs/private/nodejs_repo_host_os_alias.bzl | 5 ----- nodejs/repositories.bzl | 18 ------------------ nodejs/toolchain.bzl | 7 ------- 4 files changed, 1 insertion(+), 37 deletions(-) diff --git a/docs/Core.md b/docs/Core.md index 93f4b8aca5..4f0ec33da3 100644 --- a/docs/Core.md +++ b/docs/Core.md @@ -142,7 +142,7 @@ Defaults to `None` **USAGE**
-node_toolchain(name, headers, npm, npm_files, npm_path, run_npm, target_tool, target_tool_path)
+node_toolchain(name, headers, npm, npm_files, npm_path, target_tool, target_tool_path)
 
Defines a node toolchain for a platform. @@ -217,12 +217,6 @@ Defaults to `[]` Defaults to `""` -

run_npm

- -(*Label*): A template file that allows us to execute npm - -Defaults to `None` -

target_tool

(*Label*): A hermetically downloaded nodejs executable target for this target's platform. diff --git a/nodejs/private/nodejs_repo_host_os_alias.bzl b/nodejs/private/nodejs_repo_host_os_alias.bzl index 81064f7c77..b283ee338a 100644 --- a/nodejs/private/nodejs_repo_host_os_alias.bzl +++ b/nodejs/private/nodejs_repo_host_os_alias.bzl @@ -8,11 +8,6 @@ def _nodejs_host_os_alias_impl(repository_ctx): # Base BUILD file for this repository repository_ctx.file("BUILD.bazel", """# Generated by nodejs_repo_host_os_alias.bzl package(default_visibility = ["//visibility:public"]) -# aliases for exports_files -alias(name = "run_npm.sh.template", actual = "@{node_repository}_{os_name}//:run_npm.sh.template") -alias(name = "run_npm.bat.template", actual = "@{node_repository}_{os_name}//:run_npm.bat.template") - -# aliases for other aliases alias(name = "node_bin", actual = "@{node_repository}_{os_name}//:node_bin") alias(name = "npm_bin", actual = "@{node_repository}_{os_name}//:npm_bin") alias(name = "npx_bin", actual = "@{node_repository}_{os_name}//:npx_bin") diff --git a/nodejs/repositories.bzl b/nodejs/repositories.bzl index ecb23960df..17f4d982f5 100644 --- a/nodejs/repositories.bzl +++ b/nodejs/repositories.bzl @@ -300,27 +300,10 @@ CALL "%SCRIPT_DIR%\\{node}" %* executable = True, ) - # This template file is used by the packager tool - # `yarn publish` is not ready for use under Bazel, see https://github.com/yarnpkg/yarn/issues/610 - if repository_ctx.attr.platform.startswith("windows"): - run_npm = """ -"{node}" "{script}" TMPL_args %* -""" - else: - run_npm = """ -"{node}" "{script}" TMPL_args "$@" -""" - - repository_ctx.file("run_npm.template", content = run_npm.format( - node = repository_ctx.path(node_entry), - script = repository_ctx.path(npm_script), - )) - # Base BUILD file for this repository build_content = """# Generated by node_repositories.bzl package(default_visibility = ["//visibility:public"]) exports_files([ - "run_npm.template", "{node_entry}", "{npm_entry}", "{npx_entry}" @@ -375,7 +358,6 @@ node_toolchain( target_tool = ":node_bin", npm = ":npm", npm_files = [":npm_files"], - run_npm = ":run_npm.template", headers = ":headers", ) """ diff --git a/nodejs/toolchain.bzl b/nodejs/toolchain.bzl index 546105a01a..5655730692 100644 --- a/nodejs/toolchain.bzl +++ b/nodejs/toolchain.bzl @@ -26,8 +26,6 @@ May be empty if the target_tool_path points to a locally installed node binary." "npm_files": """Files required in runfiles to make the npm executable available. May be empty if the npm_path points to a locally installed npm binary.""", - "run_npm": """A template for a script that wraps npm. - On Windows, this is a Batch script, otherwise it uses Bash.""", "headers": """\ (struct) Information about the header files, with fields: * providers_map: a dict of string to provider instances. The key should be @@ -96,7 +94,6 @@ def _node_toolchain_impl(ctx): tool_files = tool_files, npm_path = npm_path, npm_files = npm_files, - run_npm = ctx.file.run_npm, headers = struct( providers_map = { "CcInfo": ctx.attr.headers[CcInfo], @@ -143,10 +140,6 @@ node_toolchain = rule( doc = "Files required in runfiles to run npm.", mandatory = False, ), - "run_npm": attr.label( - doc = "A template file that allows us to execute npm", - allow_single_file = True, - ), "headers": attr.label( doc = "A cc_library that contains the Node/v8 header files for this target platform.", ),