diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2016-05-09 13:53:20 -0400 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2016-05-24 09:25:02 -0400 |
commit | 7da023b892ccd7135b6c9762d7618ccf414a4cd7 (patch) | |
tree | 04eb21f4a5a59ce61be4dc974d2e7cd6857f296a /src/google/protobuf/compiler/objectivec/objectivec_helpers.h | |
parent | 2131b2d544bf6eeb789c128ef3e9e04fc299237a (diff) |
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
Diffstat (limited to 'src/google/protobuf/compiler/objectivec/objectivec_helpers.h')
-rw-r--r-- | src/google/protobuf/compiler/objectivec/objectivec_helpers.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h index 3f56d94b..5898d692 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h @@ -62,15 +62,14 @@ bool IsRetainedName(const string& name); // handling under ARC. bool IsInitName(const string& name); -// Gets the name of the file we're going to generate (sans the .pb.h -// extension). This does not include the path to that file. -string FileName(const FileDescriptor* file); - // Gets the path of the file we're going to generate (sans the .pb.h // extension). The path will be dependent on the objectivec package // declared in the proto package. string FilePath(const FileDescriptor* file); +// Just like FilePath(), but without the directory part. +string FilePathBasename(const FileDescriptor* file); + // Gets the name of the root class we'll generate in the file. This class // is not meant for external consumption, but instead contains helpers that // the rest of the classes need @@ -169,6 +168,16 @@ string BuildFlagsString(const vector<string>& strings); // Builds a HeaderDoc style comment out of the comments in the .proto file. string BuildCommentsString(const SourceLocation& location); +// The name the commonly used by the library when built as a framework. +// This lines up to the name used in the CocoaPod. +extern const char* const ProtobufLibraryFrameworkName; +// Returns the CPP symbol name to use as the gate for framework style imports +// for the given framework name to use. +string ProtobufFrameworkImportSymbol(const string& framework_name); + +// Checks if the file is one of the proto's bundled with the library. +bool IsProtobufLibraryBundledProtoFile(const FileDescriptor* file); + // Checks the prefix for a given file and outputs any warnings needed, if // there are flat out errors, then out_error is filled in and the result is // false. |