Commit Graph

4 Commits

Author SHA1 Message Date
Thomas Van Lenten
bb4302e878 Add a generation option to control use of forward declarations in headers.
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.
2022-03-03 16:05:18 -05:00
Thomas Van Lenten
020e4e33d1 Simplify imports of the WKTs within the library itself.
Overdue followup to https://github.com/protocolbuffers/protobuf/pull/7173

Since all the files are at the same level as the runtime headers, there is no
need for things to be framework based imports, they should all just work like
the other headers do.

- Directly generate the bundled header imports into the preamble section when
  generating for a bundled proto.
- Update the preamble generation to skip the CPP wrapper when generating for a
  bundled proto file.
- Regenerate the WKTs.
- Update GPBProtocolBuffer.h/GPBWellKnownTypes.h to also skip the CPP wrapping.

GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS in the podspec and non bundled files still
has to exist because that comes into play for those files to find the runtime
headers.
2022-03-01 17:01:33 -05:00
Thomas Van Lenten
b0e2792842 [ObjC] Generation changes around proto3 optional.
- Bump the version marker in the generated code.
- Set the flag to say clear on zero is known.
- Set clear on zero for proto3 optional fields that aren't tagged as optional.
- Also tweak the call from some C generated code to use different apis with
  better validation.
- Mark the ObjC generator as supporting the proto3 optional feature.
- Regenerate the WKTs to get the new flags.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
56c48ae592 Revisit how the WKTs are bundled with ObjC.
There are have been a few issues around people using case sensitive file systems
what Xcode/clang does when looking at the paths. In attempts to solve one set of
warnings, new warnings/errors happened in different setup. So, to hopefully put
these problem away for got, move the WKTs to be at the same level as the other
headers.

- Revert "Override CocoaPods module to lowercase (#6464)"
  This reverts commit 479ba8226b.
- Move WKTs to the objectivec directory and make the old headers shim back to
  the new locations.
- Update objectivec/generate_well_known_types.sh to check them one at a time
  and to deal with the new locations for them.

Fixes #6803
2020-02-10 12:20:05 -05:00