Skip to content

Commit

Permalink
Add filegroups for internal use by Fileset rule.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 670135523
Change-Id: If4078604ae09e2ee891a73d71b302385fee64147
  • Loading branch information
GCP Buildpacks Team authored and copybara-github committed Sep 2, 2024
1 parent 9641f14 commit 55cf12a
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 4 deletions.
15 changes: 15 additions & 0 deletions builders/testdata/dotnet/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,18 @@ filegroup(
name = "all_files",
srcs = glob(["**"]),
)

filegroup(
name = "functions_files",
srcs = glob(["functions/**"]),
)

filegroup(
name = "flex_files",
srcs = glob(["flex/**"]),
)

filegroup(
name = "generic_files",
srcs = glob(["generic/**"]),
)
20 changes: 20 additions & 0 deletions builders/testdata/go/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,23 @@ filegroup(
name = "all_files",
srcs = glob(["**"]),
)

filegroup(
name = "appengine_files",
srcs = glob(["appengine/**"]),
)

filegroup(
name = "functions_files",
srcs = glob(["functions/**"]),
)

filegroup(
name = "flex_files",
srcs = glob(["flex/**"]),
)

filegroup(
name = "generic_files",
srcs = glob(["generic/**"]),
)
20 changes: 20 additions & 0 deletions builders/testdata/nodejs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,23 @@ filegroup(
"//builders/testdata/nodejs/appengine:all_files",
],
)

filegroup(
name = "appengine_files",
srcs = ["//builders/testdata/nodejs/appengine:all_files"],
)

filegroup(
name = "functions_files",
srcs = glob(["functions/**"]),
)

filegroup(
name = "flex_files",
srcs = glob(["flex/**"]),
)

filegroup(
name = "generic_files",
srcs = glob(["generic/**"]),
)
20 changes: 20 additions & 0 deletions builders/testdata/php/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,23 @@ filegroup(
name = "all_files",
srcs = glob(["**"]),
)

filegroup(
name = "appengine_files",
srcs = glob(["appengine/**"]),
)

filegroup(
name = "functions_files",
srcs = glob(["functions/**"]),
)

filegroup(
name = "flex_files",
srcs = glob(["flex/**"]),
)

filegroup(
name = "generic_files",
srcs = glob(["generic/**"]),
)
20 changes: 20 additions & 0 deletions builders/testdata/python/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,23 @@ filegroup(
name = "all_files",
srcs = glob(["**"]),
)

filegroup(
name = "appengine_files",
srcs = glob(["appengine/**"]),
)

filegroup(
name = "functions_files",
srcs = glob(["functions/**"]),
)

filegroup(
name = "flex_files",
srcs = glob(["flex/**"]),
)

filegroup(
name = "generic_files",
srcs = glob(["generic/**"]),
)
20 changes: 20 additions & 0 deletions builders/testdata/ruby/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,23 @@ filegroup(
name = "all_files",
srcs = glob(["**"]),
)

filegroup(
name = "appengine_files",
srcs = glob(["appengine/**"]),
)

filegroup(
name = "functions_files",
srcs = glob(["functions/**"]),
)

filegroup(
name = "flex_files",
srcs = glob(["flex/**"]),
)

filegroup(
name = "generic_files",
srcs = glob(["generic/**"]),
)
8 changes: 4 additions & 4 deletions internal/acceptance/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -211,19 +211,19 @@ def _build_cloudbuild_test_binary(name, srcs, deps):

# _build_testdata_target creates a Fileset target for the given testdata label. The reason to do
# this is our testdata is accessed via exports_files(...) which copies the testdata into writeable
# folders. The acceptance test suite relies on the the folders being writeable. However, most Bazel
# rules, including pkg_zip or pkg_tar, are not able to accept source files that are directories. It
# requires an explicit fileset to bring in a directory of files.
# folders. The acceptance test suite relies on the the folders being writeable. We assume the
# existence of a filegroup with the name "[testdata_label]_files" to bring in the required files.
def _build_testdata_target(name, testdata):
testdata_pkg, testdata_label = testdata.split(":")
fileset_name = name + "_" + testdata_label
testdata_filegroup = testdata_label + "_files"
native.Fileset(
name = fileset_name,
out = name + "_generated/" + testdata_label,
entries = [
native.FilesetEntry(
srcdir = testdata_pkg + ":BUILD",
files = [testdata_label],
files = [testdata_filegroup],
strip_prefix = testdata_label,
),
],
Expand Down

0 comments on commit 55cf12a

Please sign in to comment.