From 7da023b892ccd7135b6c9762d7618ccf414a4cd7 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Mon, 9 May 2016 13:53:20 -0400 Subject: Better support for using the proto library from a framework. - Add generator constant for the default framework name. - Add generator api for making the CPP symbol from the name. - Add generator api to see if it is a bundled proto file. - Output a CPP conditional and two imports for the core library headers. - Add helper for generating the #import for file headers to deal with the framework imports. - Add a reference from the unittests to a WKT to use that to inspect how imports generate. - Update the podspec to define the CPP symbol and require pods 1.0 (or later). Fixes https://github.com/google/protobuf/issues/1457 --- objectivec/GPBProtocolBuffers.h | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'objectivec/GPBProtocolBuffers.h') diff --git a/objectivec/GPBProtocolBuffers.h b/objectivec/GPBProtocolBuffers.h index 677903ed..68d8854e 100644 --- a/objectivec/GPBProtocolBuffers.h +++ b/objectivec/GPBProtocolBuffers.h @@ -44,14 +44,33 @@ #import "GPBWellKnownTypes.h" #import "GPBWireFormat.h" +// This CPP symbol can be defined to use imports that match up to the framework +// imports needed when using CocoaPods. +#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS) + #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0 +#endif + // Well-known proto types -#import "google/protobuf/Any.pbobjc.h" -#import "google/protobuf/Api.pbobjc.h" -#import "google/protobuf/Duration.pbobjc.h" -#import "google/protobuf/Empty.pbobjc.h" -#import "google/protobuf/FieldMask.pbobjc.h" -#import "google/protobuf/SourceContext.pbobjc.h" -#import "google/protobuf/Struct.pbobjc.h" -#import "google/protobuf/Timestamp.pbobjc.h" -#import "google/protobuf/Type.pbobjc.h" -#import "google/protobuf/Wrappers.pbobjc.h" +#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS + #import + #import + #import + #import + #import + #import + #import + #import + #import + #import +#else + #import "google/protobuf/Any.pbobjc.h" + #import "google/protobuf/Api.pbobjc.h" + #import "google/protobuf/Duration.pbobjc.h" + #import "google/protobuf/Empty.pbobjc.h" + #import "google/protobuf/FieldMask.pbobjc.h" + #import "google/protobuf/SourceContext.pbobjc.h" + #import "google/protobuf/Struct.pbobjc.h" + #import "google/protobuf/Timestamp.pbobjc.h" + #import "google/protobuf/Type.pbobjc.h" + #import "google/protobuf/Wrappers.pbobjc.h" +#endif -- cgit v1.2.3