Skip to content

Commit

Permalink
fix: don't glob yarn or node files when using vendored_node or vendor…
Browse files Browse the repository at this point in the history
…ed_yarn
  • Loading branch information
mattem authored and alexeagle committed Sep 20, 2020
1 parent 18c6e80 commit f5ef64f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions examples/vendored_node_and_yarn/.bazelrc
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions internal/node/node_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f5ef64f

Please sign in to comment.