Skip to content

Commit

Permalink
Don't insert #import "ObjectivecDescriptor.pb.h" into generated code? #…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyxo committed Jan 14, 2015
1 parent c1dbee6 commit d21afe5
Show file tree
Hide file tree
Showing 10 changed files with 437 additions and 7 deletions.
4 changes: 2 additions & 2 deletions ProtocolBuffers.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "ProtocolBuffers"
s.version = "1.9.4"
s.version = "1.9.5"
s.summary = "Protocol Buffers for Objective-C"
s.description = <<-DESC
An implementation of Protocol Buffers 2.6 in Objective C.
Expand Down Expand Up @@ -41,7 +41,7 @@ Pod::Spec.new do |s|
s.authors = { "Alexey Khokhlov" => "alexeyxo@gmail.com" }

s.source = {
:git => "https://github.com/alexeyxo/protobuf-objc.git", :tag => "1.9.4"
:git => "https://github.com/alexeyxo/protobuf-objc.git", :tag => s.version
}
s.header_dir = "ProtocolBuffers"
s.source_files = 'src/runtime/Classes/*.{h,m}'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ How To Install Protobuf

8.`cd <your .xcodeproj directory>`

9.`echo -e "platform :ios , 6.0 \nlink_with '<YourAppTarget>', '<YourAppTarget_Test>' \npod 'ProtocolBuffers', '1.9.4' " > Podfile`
9.`echo -e "platform :ios , 6.0 \nlink_with '<YourAppTarget>', '<YourAppTarget_Test>' \npod 'ProtocolBuffers', '1.9.5' " > Podfile`

10.`pod install`

Expand Down
8 changes: 5 additions & 3 deletions src/compiler/objc_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ namespace google { namespace protobuf { namespace compiler {namespace objectivec
// }

for (int i = 0; i < file_->dependency_count(); i++) {
printer->Print(
"#import \"$header$.pb.h\"\n",
"header", FilePath(file_->dependency(i)));
if (!isObjectivecFileOptions(FilePath(file_->dependency(i)))) {
printer->Print(
"#import \"$header$.pb.h\"\n",
"header", FilePath(file_->dependency(i)));
}
}

printer->Print(
Expand Down
4 changes: 4 additions & 0 deletions src/compiler/objc_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
return file->name() == "google/protobuf/descriptor.proto";
}

bool isObjectivecFileOptions(const string& name) {
return name == "ObjectivecDescriptor";
}


string FileName(const FileDescriptor* file) {
string basename;
Expand Down
1 change: 1 addition & 0 deletions src/compiler/objc_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ namespace google {
bool IsRetainedName(const string& name);

bool IsBootstrapFile(const FileDescriptor* file);
bool isObjectivecFileOptions(const string& name);

bool isObjectArray(const FieldDescriptor* field);
// Gets the name of the file we're going to generate (sans the .pb.h
Expand Down
129 changes: 129 additions & 0 deletions src/runtime/Classes/ObjectivecDescriptor.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d21afe5

Please sign in to comment.