Skip to content

Add a generation option to control use of forward declarations in headers.#9568

Merged
thomasvl merged 1 commit intoprotocolbuffers:masterfrom
thomasvl:use_imports
Mar 3, 2022
Merged

Add a generation option to control use of forward declarations in headers.#9568
thomasvl merged 1 commit intoprotocolbuffers:masterfrom
thomasvl:use_imports

Conversation

@thomasvl
Copy link
Copy Markdown
Contributor

@thomasvl thomasvl commented Mar 2, 2022

Swift importing ObjC drops methods/properties if the type is only a forward
declaration since the type is incomplete. Historically the generator has always
use forward declarations to reduce how much will have rebuild when a proto file
does change; but that puts it at odds with Swift. If ObjC Protos end up spanning
Swift modules, the Swift import behavior could become a problem; so this option
provides a control for the behavior. The current behavior is to continue forward
declarations, but eventually the default will be changed.

Generate the WKTs using imports instead of forward decls.

Comment thread src/google/protobuf/compiler/objectivec/objectivec_file.cc
Comment thread src/google/protobuf/compiler/objectivec/objectivec_file.cc
@thomasvl
Copy link
Copy Markdown
Contributor Author

thomasvl commented Mar 2, 2022

@dmaclach fyi

@dmaclach
Copy link
Copy Markdown
Contributor

dmaclach commented Mar 2, 2022

Can you add me as a reviewer? I can't seem to do it for some reason...

@thomasvl
Copy link
Copy Markdown
Contributor Author

thomasvl commented Mar 2, 2022

Can you add me as a reviewer? I can't seem to do it for some reason...

I think this repo/project locks down reviewers.

@fowles fowles requested a review from haberman March 2, 2022 17:43
Copy link
Copy Markdown
Contributor

@dmaclach dmaclach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval.. all documentation nits I believe.

Comment thread objectivec/README.md Outdated
Comment thread objectivec/README.md Outdated
Comment thread objectivec/README.md Outdated
Comment thread objectivec/README.md Outdated
Comment thread objectivec/README.md Outdated
Comment thread src/google/protobuf/compiler/objectivec/objectivec_file.cc Outdated
Comment thread src/google/protobuf/compiler/objectivec/objectivec_file.cc
Comment thread src/google/protobuf/compiler/objectivec/objectivec_file.cc Outdated
…ders.

Swift importing ObjC drops methods/properties if the type is only a forward
declaration since the type is incomplete. Historically the generator has always
use forward declarations to reduce how much will have rebuild when a proto file
does change; but that puts it at odds with Swift. If ObjC Protos end up spanning
Swift modules, the Swift import behavior could become a problem; so this option
provides a control for the behavior. The current behavior is to continue forward
declarations, but eventually the default will be changed.

Generate the WKTs using imports instead of forward decls.
@thomasvl thomasvl merged commit bb4302e into protocolbuffers:master Mar 3, 2022
@thomasvl thomasvl deleted the use_imports branch March 3, 2022 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants