rules_swift icon indicating copy to clipboard operation
rules_swift copied to clipboard

Add swift_proto_library_group rule

Open AttilaTheFun opened this issue 1 year ago • 0 comments

I recently merged https://github.com/bazelbuild/rules_swift/pull/1140 which introduced a new, highly-customizable swift_proto_library implementation.

However, because this dropped support for the proto aspect, consumers of the deprecated rules who relied on this behavior and don't want to use a tool like gazelle to generate their build files will have a hard time migrating to the new rules.

This PR introduces a new swift_proto_library_group rule which uses an aspect and functions very similarly to the deprecated rule to facilitate their migration. Because of the limitations of aspects, though, they will be unable to benefit from all of the customization options afforded to the new swift_proto_library rule including different compilers and module names. This was true of the deprecated rules and it will be true of the aspect-based rule as well.

To avoid repeated / diverging logic, I extracted most of the logic necessary to generate the swift source files and compile them + aggregate the providers into the swift_proto_utils.bzl file and shared this between the swift_proto_library and swift_proto_library_group rule.

AttilaTheFun avatar Feb 23 '24 17:02 AttilaTheFun