diff options
author | Feng Xiao <xiaofeng@google.com> | 2016-07-25 10:19:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-25 10:19:17 -0700 |
commit | b6cd9dd759a2a3f53b8260431566aab82f7f83ac (patch) | |
tree | 00a52d24d9cedb49589bafe879279b374b49a485 | |
parent | 44bd6bda58d3889c06e82c5060609182f124aba3 (diff) | |
parent | 3a1259cb45a21d014be9241991ef2245888a3f25 (diff) |
Merge pull request #1834 from sergiocampama/framework
Correctly sets the generate_for_named_framework option after parsing.
-rw-r--r-- | src/google/protobuf/compiler/objectivec/objectivec_generator.cc | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_generator.cc b/src/google/protobuf/compiler/objectivec/objectivec_generator.cc index 29a8765c..a0b6d6cb 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_generator.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_generator.cc @@ -50,7 +50,12 @@ bool ObjectiveCGenerator::Generate(const FileDescriptor* file, OutputDirectory* output_directory, string* error) const { // ----------------------------------------------------------------- - // Parse generator options. + // Parse generator options. These options are passed to the compiler using the + // --objc_opt flag. The options are passed as a comma separated list of + // options along with their values. If the option appears multiple times, only + // the last value will be considered. + // + // e.g. protoc ... --objc_opt=expected_prefixes=file.txt,generate_for_named_framework=MyFramework Options generation_options; @@ -70,7 +75,7 @@ bool ObjectiveCGenerator::Generate(const FileDescriptor* file, // (i.e. - "package=prefix # comment") // // There is no validation that the prefixes are good prefixes, it is - // assume they are when you create the file. + // assumed that they are when you create the file. generation_options.expected_prefixes_path = options[i].second; } else if (options[i].first == "generate_for_named_framework") { // The name of the framework that protos are being generated for. This @@ -79,11 +84,12 @@ bool ObjectiveCGenerator::Generate(const FileDescriptor* file, // // NOTE: If this option is used with // named_framework_to_proto_path_mappings_path, then this is effectively - // the "default" to use for everything that wasn't mapped by the other. - generation_options.named_framework_to_proto_path_mappings_path = options[i].second; + // the "default" framework name used for everything that wasn't mapped by + // the mapping file. + generation_options.generate_for_named_framework = options[i].second; } else if (options[i].first == "named_framework_to_proto_path_mappings_path") { - // Path to find a file containing the listing of framework names and - // proto files. The generator uses this to decide if another proto file + // Path to find a file containing the list of framework names and proto + // files. The generator uses this to decide if a proto file // referenced should use a framework style import vs. a user level import // (#import <FRAMEWORK/file.pbobjc.h> vs #import "dir/file.pbobjc.h"). // @@ -97,8 +103,11 @@ bool ObjectiveCGenerator::Generate(const FileDescriptor* file, // with commas. // // There can be multiple lines listing the same frameworkName incase it - // has a lot of proto files included in it; and having multiple lines - // makes things easier to read. + // has a lot of proto files included in it; having multiple lines makes + // things easier to read. If a proto file is not configured in the + // mappings file, it will use the default framework name if one was passed + // with generate_for_named_framework, or the relative path to it's include + // path otherwise. generation_options.named_framework_to_proto_path_mappings_path = options[i].second; } else { *error = "error: Unknown generator option: " + options[i].first; |