Skip to content

Commit d21afe5

Browse files
committed
Don't insert #import "ObjectivecDescriptor.pb.h" into generated code? #26
1 parent c1dbee6 commit d21afe5

10 files changed

Lines changed: 437 additions & 7 deletions

File tree

ProtocolBuffers.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "ProtocolBuffers"
3-
s.version = "1.9.4"
3+
s.version = "1.9.5"
44
s.summary = "Protocol Buffers for Objective-C"
55
s.description = <<-DESC
66
An implementation of Protocol Buffers 2.6 in Objective C.
@@ -41,7 +41,7 @@ Pod::Spec.new do |s|
4141
s.authors = { "Alexey Khokhlov" => "alexeyxo@gmail.com" }
4242

4343
s.source = {
44-
:git => "https://github.com/alexeyxo/protobuf-objc.git", :tag => "1.9.4"
44+
:git => "https://github.com/alexeyxo/protobuf-objc.git", :tag => s.version
4545
}
4646
s.header_dir = "ProtocolBuffers"
4747
s.source_files = 'src/runtime/Classes/*.{h,m}'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ How To Install Protobuf
3434

3535
8.`cd <your .xcodeproj directory>`
3636

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

3939
10.`pod install`
4040

src/compiler/objc_file.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ namespace google { namespace protobuf { namespace compiler {namespace objectivec
5252
// }
5353

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

6062
printer->Print(

src/compiler/objc_helpers.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
216216
return file->name() == "google/protobuf/descriptor.proto";
217217
}
218218

219+
bool isObjectivecFileOptions(const string& name) {
220+
return name == "ObjectivecDescriptor";
221+
}
222+
219223

220224
string FileName(const FileDescriptor* file) {
221225
string basename;

src/compiler/objc_helpers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ namespace google {
5151
bool IsRetainedName(const string& name);
5252

5353
bool IsBootstrapFile(const FileDescriptor* file);
54+
bool isObjectivecFileOptions(const string& name);
5455

5556
bool isObjectArray(const FieldDescriptor* field);
5657
// Gets the name of the file we're going to generate (sans the .pb.h

src/runtime/Classes/ObjectivecDescriptor.pb.h

Lines changed: 129 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)