bazel-contrib / rules_bazel_integration_test

Rules and macros for executing integration tests that use Bazel. Supports running integration tests with multiple versions of Bazel.
Apache License 2.0
40 stars 7 forks source link

Create a Gazelle plugin that adds the appropriate `all_files` `filegroup` declarations #86

Open cgrindel opened 1 year ago

cgrindel commented 1 year ago

When adding new Bazel packages to a workspace, it would be very useful to have the all_files filegroup added to the new packages and have the filegroup at the root updated with those targets.

Also, there could be a performance benefit to not use glob() and list the files.

achew22 commented 1 year ago

You might consider https://github.com/bazelbuild/bazel-gazelle/blob/master/internal/language/test_filegroup/lang.go

cgrindel commented 1 year ago

That is where I got the idea. 😀

achew22 commented 1 year ago

Honestly, I wouldn't mind if you wanted to turn that into a reusable plug-in in the gazelle repo

cgrindel commented 1 year ago

That could work. However, there is some special handling that I would add at the root of the workspace. There are two special cases that I foresee.

  1. Typically, we don't include test files, because they are not needed for the child workspace integration tests.
  2. By convention, we create a filegroup called local_repository_files that is a collection of the "all_files" from the non-test packages.

If we do want to promote test_filegroup, we could just have it add the "all_files" everywhere, then have a rules_bazel_integration_test Gazelle plugin that handles the root filegroup, only collecting the non-test packages. It does start to introduce some dependency issues between different Gazelle plugins. Are you aware of any existing Gazelle plugins that require another plugin to have been run beforehand?

Chuck

On Wed, Nov 23, 2022 at 12:10 PM Andrew Z Allen @.***> wrote:

Honestly, I wouldn't mind if you wanted to turn that into a reusable plug-in in the gazelle repo

— Reply to this email directly, view it on GitHub https://github.com/bazel-contrib/rules_bazel_integration_test/issues/86#issuecomment-1325541942, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABHBYBEPGCNCOYPOSQ6M2DWJZT2BANCNFSM6AAAAAASJGSFCU . You are receiving this because you authored the thread.Message ID: @.*** com>

achew22 commented 1 year ago

I am aware of at least one. the proto language must be run before the go language in order to produce go_proto_library targets. Hope that helps!

Message ID: @.*** com>