From 55cf12afe0bcb1d6aeb63cdd08ecdad41ebc6421 Mon Sep 17 00:00:00 2001 From: GCP Buildpacks Team Date: Mon, 2 Sep 2024 02:19:48 -0700 Subject: [PATCH] Add filegroups for internal use by Fileset rule. PiperOrigin-RevId: 670135523 Change-Id: If4078604ae09e2ee891a73d71b302385fee64147 --- builders/testdata/dotnet/BUILD.bazel | 15 +++++++++++++++ builders/testdata/go/BUILD.bazel | 20 ++++++++++++++++++++ builders/testdata/nodejs/BUILD.bazel | 20 ++++++++++++++++++++ builders/testdata/php/BUILD.bazel | 20 ++++++++++++++++++++ builders/testdata/python/BUILD.bazel | 20 ++++++++++++++++++++ builders/testdata/ruby/BUILD.bazel | 20 ++++++++++++++++++++ internal/acceptance/defs.bzl | 8 ++++---- 7 files changed, 119 insertions(+), 4 deletions(-) diff --git a/builders/testdata/dotnet/BUILD.bazel b/builders/testdata/dotnet/BUILD.bazel index 8ef08c665..797f97854 100644 --- a/builders/testdata/dotnet/BUILD.bazel +++ b/builders/testdata/dotnet/BUILD.bazel @@ -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/**"]), +) diff --git a/builders/testdata/go/BUILD.bazel b/builders/testdata/go/BUILD.bazel index 5eede52b4..02cd6c8b8 100644 --- a/builders/testdata/go/BUILD.bazel +++ b/builders/testdata/go/BUILD.bazel @@ -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/**"]), +) diff --git a/builders/testdata/nodejs/BUILD.bazel b/builders/testdata/nodejs/BUILD.bazel index f13c5a01b..23b071243 100644 --- a/builders/testdata/nodejs/BUILD.bazel +++ b/builders/testdata/nodejs/BUILD.bazel @@ -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/**"]), +) diff --git a/builders/testdata/php/BUILD.bazel b/builders/testdata/php/BUILD.bazel index a47024213..3351cf14a 100644 --- a/builders/testdata/php/BUILD.bazel +++ b/builders/testdata/php/BUILD.bazel @@ -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/**"]), +) diff --git a/builders/testdata/python/BUILD.bazel b/builders/testdata/python/BUILD.bazel index a47024213..3351cf14a 100644 --- a/builders/testdata/python/BUILD.bazel +++ b/builders/testdata/python/BUILD.bazel @@ -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/**"]), +) diff --git a/builders/testdata/ruby/BUILD.bazel b/builders/testdata/ruby/BUILD.bazel index a47024213..3351cf14a 100644 --- a/builders/testdata/ruby/BUILD.bazel +++ b/builders/testdata/ruby/BUILD.bazel @@ -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/**"]), +) diff --git a/internal/acceptance/defs.bzl b/internal/acceptance/defs.bzl index eb262afd4..5a860cc10 100644 --- a/internal/acceptance/defs.bzl +++ b/internal/acceptance/defs.bzl @@ -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, ), ],