-
Notifications
You must be signed in to change notification settings - Fork 160
Add swift_proto_library_group rule #1173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add swift_proto_library_group rule #1173
Conversation
3a790c7 to
7de082a
Compare
c44496b to
74cf25d
Compare
examples/xplatform/custom_swift_proto_compiler/rules/custom_swift_proto_compiler.bzl
Outdated
Show resolved
Hide resolved
examples/xplatform/custom_swift_proto_compiler/rules/custom_swift_proto_compiler.bzl
Outdated
Show resolved
Hide resolved
examples/xplatform/custom_swift_proto_compiler/rules/custom_swift_proto_compiler.bzl
Outdated
Show resolved
Hide resolved
|
@AttilaTheFun @brentleyjones In case I am missing something, is there way to apply New proto rules dont seem to respect as with new I was migrating from old proto and due to large scale, tried to use |
|
@rasberik the swift_proto_library_group doesn't support that attribute yet, but you can customize the swift_proto_compiler through the compiler attribute here: On your custom swift_proto_compiler target you can customize the options, so you can accomplish this that way. You're welcome to create a feature request or PR to add the additional_compiler_info attribute to swift_proto_library_group and plumb it into the aspect through the transition similar to the compiler attribute. I think this would be fairly simple? |
I recently merged #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 some of the customization options afforded to the new swift_proto_library rule including custom 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 rules.
I've also added a working GRPC example which shows how to combine swift_proto_library and swift_proto_library_group targets. As with the old rule, swift_proto_library_group does not support GRPC generation directly. However, you can create a swift_proto_library target to generate your service protos which depends on a swift_proto_library_group which generates everything else. This is how the deprecated rules behaved with a swift_grpc_library depending on a (deprecated) swift_proto_library target.