aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/objectivec/objectivec_file.cc
diff options
context:
space:
mode:
authorGravatar Thomas Van Lenten <thomasvl@google.com>2018-03-30 18:09:58 -0400
committerGravatar Thomas Van Lenten <thomasvl@google.com>2018-04-02 09:54:29 -0400
commitbd941d5d69de8eeea6a10669fab9a4605c95650e (patch)
tree9192193878b9534b334e928464e7c8ca739bbfb8 /src/google/protobuf/compiler/objectivec/objectivec_file.cc
parente998b8ff66e37fc7eb7313629bd10e86f857e909 (diff)
Don't generate imports for the WKTs unless generating the WKTs.
Since the generated header import GPBProtocolBuffers.h, there is no need to generate imports for the WKTs as they will have already been imported.
Diffstat (limited to 'src/google/protobuf/compiler/objectivec/objectivec_file.cc')
-rw-r--r--src/google/protobuf/compiler/objectivec/objectivec_file.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_file.cc b/src/google/protobuf/compiler/objectivec/objectivec_file.cc
index 2b14bbe8..f0d9b4d5 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_file.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_file.cc
@@ -188,6 +188,7 @@ bool IsDirectDependency(const FileDescriptor* dep, const FileDescriptor* file) {
FileGenerator::FileGenerator(const FileDescriptor *file, const Options& options)
: file_(file),
root_class_name_(FileClassName(file)),
+ is_bundled_proto_(IsProtobufLibraryBundledProtoFile(file)),
options_(options) {
for (int i = 0; i < file_->enum_type_count(); i++) {
EnumGenerator *generator = new EnumGenerator(file_->enum_type(i));
@@ -217,7 +218,7 @@ void FileGenerator::GenerateHeader(io::Printer *printer) {
std::set<string> headers;
// Generated files bundled with the library get minimal imports, everything
// else gets the wrapper so everything is usable.
- if (IsProtobufLibraryBundledProtoFile(file_)) {
+ if (is_bundled_proto_) {
headers.insert("GPBRootObject.h");
headers.insert("GPBMessage.h");
headers.insert("GPBDescriptor.h");
@@ -246,7 +247,8 @@ void FileGenerator::GenerateHeader(io::Printer *printer) {
{
ImportWriter import_writer(
options_.generate_for_named_framework,
- options_.named_framework_to_proto_path_mappings_path);
+ options_.named_framework_to_proto_path_mappings_path,
+ is_bundled_proto_);
const string header_extension(kHeaderExtension);
for (int i = 0; i < file_->public_dependency_count(); i++) {
import_writer.AddFile(file_->public_dependency(i), header_extension);
@@ -364,7 +366,8 @@ void FileGenerator::GenerateSource(io::Printer *printer) {
{
ImportWriter import_writer(
options_.generate_for_named_framework,
- options_.named_framework_to_proto_path_mappings_path);
+ options_.named_framework_to_proto_path_mappings_path,
+ is_bundled_proto_);
const string header_extension(kHeaderExtension);
// #import the header for this proto file.