Feature Request: Auto-discovery of top-level targets
In our current project generator, top-level targets are auto-discovered based on the provided target kinds. For example, if we request ios_application and ios_unit_test in the //path/to/package package, all ios_application and ios_unit_test targets defined in that package will be included in the generated project. The motivation is to remove the need to update the xcodeproj target whenever someone adds a new target.
The xcodeproj rule currently requires top-level targets to be explicitly specified via the top_level_targets attribute.
Found this in the docs https://github.com/buildbuddy-io/rules_xcodeproj/blob/main/doc/design/high-level.md#defined-in-build-files, will use the recommended approach for now.
There's a problem with the dynamic generation approach is that the workspace won't be a valid Bazel workspace until the generation is done, making the generation step a dependency of the build even if we build without the Xcode project.
To work around the invalid workspace, we can write the BUILD file and any needed .bzl files into .rules_xcodeproj/. Users can add that to their .gitignore. The runner script will create the generator target in there. Only the runner script would invoke the generator target, so the workspace will never be in an invalid state.
With https://github.com/buildbuddy-io/rules_xcodeproj/commit/9138d70a2955c9307f9c599e0d8655908d54e5e7, we now generate the BUILD and .bzl files for the generator target. That can be extended to be the result of a query.