feat: support customizing generated BUILD files for Swift packages
enhancement
## Summary
We've received multiple requests for the ability to customize or override the BUILD files that are generated for Swift packages. Currently, the auto-generated BUILD files cannot be modified by users, and even patched-in BUILD files may not survive the generation process.
## Use Cases
1. **Override/customize generated BUILD files** — Modify or replace what gets auto-generated for a package (e.g., to support building a package in multiple configurations with different environment variables).
2. **Add BUILD files that aren't generated** — Add a BUILD file to a package subdirectory that Gazelle doesn't generate one for (e.g., to export a specific file).
## Prior Discussion
- https://bazelbuild.slack.com/archives/C05NZSHE7FU/p1774644485816069
- https://bazelbuild.slack.com/archives/C05NZSHE7FU/p1773254132884349
## Looking for Feedback
We'd like community input on the desired behavior and approach. Some questions to consider:
- Should we support `build_file` / `build_file_content` attributes (similar to `http_archive`) to fully replace a generated BUILD file?
- Should we support a post-generation overlay/patch mechanism that merges user-provided content with the generated BUILD file?
- Should we support both adding new BUILD files and modifying/replacing existing generated ones?
- Are there other approaches or patterns from the Bazel ecosystem that would work well here?
If you have a use case for this feature, please share it here so we can design a solution that covers the common scenarios.
0 条评论