Эх сурвалжийг харах

Now that the paths are the same, use one ivar to track the values.

This changes when we moved the WKTs to the root of the runtime package.
Thomas Van Lenten 5 жил өмнө
parent
commit
57be643a36

+ 6 - 10
src/google/protobuf/compiler/objectivec/objectivec_helpers.cc

@@ -1585,8 +1585,7 @@ void ImportWriter::AddFile(const FileDescriptor* file,
     if (include_wkt_imports_) {
       const string header_name =
         "GPB" + FilePathBasename(file) + header_extension;
-      protobuf_framework_imports_.push_back(header_name);
-      protobuf_non_framework_imports_.push_back(header_name);
+      protobuf_imports_.push_back(header_name);
     }
     return;
   }
@@ -1616,20 +1615,17 @@ void ImportWriter::AddFile(const FileDescriptor* file,
 }
 
 void ImportWriter::Print(io::Printer* printer) const {
-  assert(protobuf_non_framework_imports_.size() ==
-         protobuf_framework_imports_.size());
-
   bool add_blank_line = false;
 
-  if (!protobuf_framework_imports_.empty()) {
+  if (!protobuf_imports_.empty()) {
     const string framework_name(ProtobufLibraryFrameworkName);
     const string cpp_symbol(ProtobufFrameworkImportSymbol(framework_name));
 
     printer->Print(
         "#if $cpp_symbol$\n",
         "cpp_symbol", cpp_symbol);
-    for (std::vector<string>::const_iterator iter = protobuf_framework_imports_.begin();
-         iter != protobuf_framework_imports_.end(); ++iter) {
+    for (std::vector<string>::const_iterator iter = protobuf_imports_.begin();
+         iter != protobuf_imports_.end(); ++iter) {
       printer->Print(
           " #import <$framework_name$/$header$>\n",
           "framework_name", framework_name,
@@ -1637,8 +1633,8 @@ void ImportWriter::Print(io::Printer* printer) const {
     }
     printer->Print(
         "#else\n");
-    for (std::vector<string>::const_iterator iter = protobuf_non_framework_imports_.begin();
-         iter != protobuf_non_framework_imports_.end(); ++iter) {
+    for (std::vector<string>::const_iterator iter = protobuf_imports_.begin();
+         iter != protobuf_imports_.end(); ++iter) {
       printer->Print(
           " #import \"$header$\"\n",
           "header", *iter);

+ 1 - 2
src/google/protobuf/compiler/objectivec/objectivec_helpers.h

@@ -305,8 +305,7 @@ class PROTOC_EXPORT ImportWriter {
   std::map<string, string> proto_file_to_framework_name_;
   bool need_to_parse_mapping_file_;
 
-  std::vector<string> protobuf_framework_imports_;
-  std::vector<string> protobuf_non_framework_imports_;
+  std::vector<string> protobuf_imports_;
   std::vector<string> other_framework_imports_;
   std::vector<string> other_imports_;
 };