From 0125677cfe320dc613b224cd98e6ef5594b0505b Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Fri, 2 Dec 2022 16:36:23 +0000 Subject: [PATCH] build: always ensure `node_modules` folders are not picked up in AIO (#48329) AIO has two risk places where `node_modules` folders may exist and may be accidentally picked up by Bazel- even though they are already added as part of `.bazelignore` and made visible through `.gitignore`. It doesn't hurt instructing Bazel to always ignore `node_modules` as part of the `glob` instruction. Co-authored-by: Joey Perrott PR Close #48329 --- aio/content/examples/examples.bzl | 5 ++++- aio/tools/examples/shared/BUILD.bazel | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/aio/content/examples/examples.bzl b/aio/content/examples/examples.bzl index 17aa04cc423..c5f457bf6ef 100644 --- a/aio/content/examples/examples.bzl +++ b/aio/content/examples/examples.bzl @@ -115,7 +115,10 @@ def docs_example(name, test = True, test_tags = [], test_exec_properties = {}, f native.filegroup( name = "files", - srcs = native.glob(["**"], exclude = ["BUILD.bazel"]), + srcs = native.glob(["**"], exclude = [ + "BUILD.bazel", + "**/node_modules/**", # Node modules may exist from the legacy setup. + ]), ) # Generate example boilerplate diff --git a/aio/tools/examples/shared/BUILD.bazel b/aio/tools/examples/shared/BUILD.bazel index e8fdf3bb7d6..b624a3bed27 100644 --- a/aio/tools/examples/shared/BUILD.bazel +++ b/aio/tools/examples/shared/BUILD.bazel @@ -4,6 +4,9 @@ filegroup( name = "shared", srcs = glob( ["**"], - exclude = ["BUILD.bazel"], + exclude = [ + "BUILD.bazel", + "**/node_modules/**", # Node modules may exist from the legacy setup. + ], ), )