Skip to content

refactor: introduce helper for defining distribution filegroups - #4152

Open
rickeylev wants to merge 3 commits into
bazel-contrib:mainfrom
rickeylev:helper_dist_file_groups
Open

refactor: introduce helper for defining distribution filegroups#4152
rickeylev wants to merge 3 commits into
bazel-contrib:mainfrom
rickeylev:helper_dist_file_groups

Conversation

@rickeylev

Copy link
Copy Markdown
Collaborator

Previously, distribution filegroups required manually enumerating each
direct subpackage's distribution target in srcs. This created
repetitive boilerplate across BUILD files and risked omitting newly
added subpackages from release distributions.

Introduce the distribution_filegroup macro to automatically glob
package files and discover direct subpackages using
native.subpackages(), with support for an exclude list.

  • Also updates BUILD files across the repository to use the new macro

Previously, distribution filegroups required manually enumerating each
direct subpackage's distribution target in `srcs`. This created
repetitive boilerplate across BUILD files and risked omitting newly
added subpackages from release distributions.

Introduce the `distribution_filegroup` macro to automatically glob
package files and discover direct subpackages using `native.subpackages()`,
with support for an `exclude` list.

* Also updates BUILD files across the repository to use the new macro
@rickeylev
rickeylev requested a review from aignas as a code owner September 6, 2026 19:30
The root distribution archive omitted tools/build_defs/python/private
because native.subpackages(include = ["*"]) in tools/BUILD.bazel only
discovers direct subpackages. Without an intermediate package boundary,
the nested tools/build_defs/python package was skipped.

Add distribution_filegroup targets to tools/build_defs/BUILD.bazel and
tools/build_defs/python/BUILD.bazel so the distribution filegroup chain
recursively reaches tools/build_defs/python/private.
Downstream packaging fails because //tools/publish loads
//tools/private:publish_deps.bzl. Remove the exclude list so that
tools/private is included in distribution archives.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant