-
Notifications
You must be signed in to change notification settings - Fork 466
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 option to annotate imports with @_implementationOnly #1393
Conversation
b6131ca
to
5264c9f
Compare
There was past discussion in #1157, I haven't looked in detail at this, but I'm guessing it is the same idea. |
So taking a quick skim at this PR and #1157 it looks like this slightly don't align. So within the
I believe (1) is what #1157 was originally after and would allow the generated types to be then exposed without exposing the fact that they are proto based objects. But I'm not as clear how (2) would work in all cases, if the generated files are marked as |
The one use-case where The second problem is interesting but I think should just work by making sure that any other import that we add via |
5264c9f
to
daafd62
Compare
|
Should this option also be expose in the SwiftPM plugin support? |
@thomasvl yes it should be exposed. I can see scenarios where projects use the SPM plug-in while shipping frameworks with library evolution enabled. |
We can expose it, although I should mention that the module mappings option isn't exposed, and I'm not actually sure we can get it to work properly/in all scenarios given the sandboxing of the plugin. This may mean that in scenarios where the module mappings option is used, users are probably not using the SPM plugin anyways. But yes, I can add support for this new option in the plugin. |
Yes this is expected. IMO we need to come up with a different strategy for module dependencies with the SPM plug-in. This requires more thinking and experimenting and isn’t in scope of this work. |
This PR adds a new option to the protoc generator that annotates imports as
@_implementationOnly
when the visibility of the protos is set asinternal
. This is useful when framework owners using protobuf don't want to expose internal-only types transitively imported via protos to clients.