From f5ef64fbe5b3c86c9243d23d3616eb4d1e2b363c Mon Sep 17 00:00:00 2001 From: Matt Mackay Date: Sun, 13 Sep 2020 13:57:23 -0400 Subject: [PATCH] fix: don't glob yarn or node files when using vendored_node or vendored_yarn --- examples/vendored_node_and_yarn/.bazelrc | 4 ++++ internal/node/node_repositories.bzl | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/vendored_node_and_yarn/.bazelrc b/examples/vendored_node_and_yarn/.bazelrc index 3431057af6..11da49bc73 100644 --- a/examples/vendored_node_and_yarn/.bazelrc +++ b/examples/vendored_node_and_yarn/.bazelrc @@ -1 +1,5 @@ import %workspace%/../../common.bazelrc + +# ensure that the globs that are used in node_repositories are removed when +# using vendored node or yarn +build --incompatible_disallow_empty_glob diff --git a/internal/node/node_repositories.bzl b/internal/node/node_repositories.bzl index 5143ccbf55..489029b97f 100644 --- a/internal/node/node_repositories.bzl +++ b/internal/node/node_repositories.bzl @@ -630,17 +630,19 @@ filegroup( ) filegroup( name = "yarn_files", - srcs = glob(["bin/yarnpkg/**"]) + [":node_files"], + srcs = {yarn_files_glob}[":node_files"], ) filegroup( name = "npm_files", - srcs = glob(["bin/nodejs/**"]) + [":node_files"], + srcs = {npm_files_glob}[":node_files"], ) """.format( node_bin_export = "" if repository_ctx.attr.vendored_node else ("\n \"%s\"," % node_bin), npm_bin_export = "" if repository_ctx.attr.vendored_node else ("\n \"%s\"," % npm_bin), npx_bin_export = "" if repository_ctx.attr.vendored_node else ("\n \"%s\"," % npx_bin), + npm_files_glob = "" if repository_ctx.attr.vendored_node else "glob([\"bin/nodejs/**\"]) + ", yarn_bin_export = "" if repository_ctx.attr.vendored_yarn else ("\n \"%s\"," % yarn_bin), + yarn_files_glob = "" if repository_ctx.attr.vendored_yarn else "glob([\"bin/yarnpkg/**\"]) + ", node_bin_label = node_bin_label, npm_bin_label = npm_bin_label, npx_bin_label = npx_bin_label,