diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2016-08-23 11:14:18 -0400 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2016-08-23 11:19:38 -0400 |
commit | 290d26b46266bb8e0ddcc542cf465719135b401a (patch) | |
tree | 263afd80cda7753ddc9bb6fdffe885531c69169d /src/google/protobuf/compiler/objectivec/objectivec_file.cc | |
parent | 93362a5aa552a7797a54efd05ccc678348ff9ef7 (diff) |
Remove the compiler options from ImportWriter.
Breaks the tie of the ImportWriter to the ObjC generation, allow grpc to use
a different extension and to relay the values they need for these.
- Pass in the two framework options to the ctor.
- Pass in the header extension to AddFile.
Diffstat (limited to 'src/google/protobuf/compiler/objectivec/objectivec_file.cc')
-rw-r--r-- | src/google/protobuf/compiler/objectivec/objectivec_file.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_file.cc b/src/google/protobuf/compiler/objectivec/objectivec_file.cc index 26babad5..1b7b2783 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_file.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_file.cc @@ -51,6 +51,8 @@ namespace protobuf { // runtime being used. const int32 GOOGLE_PROTOBUF_OBJC_GEN_VERSION = 30001; +const char* kHeaderExtension = ".pbobjc.h"; + namespace compiler { namespace objectivec { @@ -100,13 +102,16 @@ void FileGenerator::GenerateHeader(io::Printer *printer) { // #import any headers for "public imports" in the proto file. { - ImportWriter import_writer(options_); + ImportWriter import_writer( + options_.generate_for_named_framework, + options_.named_framework_to_proto_path_mappings_path); const vector<FileGenerator *> &dependency_generators = DependencyGenerators(); + const string header_extension(kHeaderExtension); for (vector<FileGenerator *>::const_iterator iter = dependency_generators.begin(); iter != dependency_generators.end(); ++iter) { if ((*iter)->IsPublicDependency()) { - import_writer.AddFile((*iter)->file_); + import_writer.AddFile((*iter)->file_, header_extension); } } import_writer.Print(printer); @@ -208,10 +213,13 @@ void FileGenerator::GenerateSource(io::Printer *printer) { PrintFileRuntimePreamble(printer, "GPBProtocolBuffers_RuntimeSupport.h"); { - ImportWriter import_writer(options_); + ImportWriter import_writer( + options_.generate_for_named_framework, + options_.named_framework_to_proto_path_mappings_path); + const string header_extension(kHeaderExtension); // #import the header for this proto file. - import_writer.AddFile(file_); + import_writer.AddFile(file_, header_extension); // #import the headers for anything that a plain dependency of this proto // file (that means they were just an include, not a "public" include). @@ -221,7 +229,7 @@ void FileGenerator::GenerateSource(io::Printer *printer) { dependency_generators.begin(); iter != dependency_generators.end(); ++iter) { if (!(*iter)->IsPublicDependency()) { - import_writer.AddFile((*iter)->file_); + import_writer.AddFile((*iter)->file_, header_extension); } } |