chengxxxxwang / metasyntactic

Automatically exported from code.google.com/p/metasyntactic
Apache License 2.0
0 stars 0 forks source link

Setting a class_prefix option in my proto file generates dummy dependancies #135

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have a .proto file, for which I want to generate Objective C and python 
classes. My Objective C classes are prefixed with LC, so I decided to add these 
lines to my .proto file:

import "google/protobuf/objectivec-descriptor.proto";
option (google.protobuf.objectivec_file_options).class_prefix = "LC";

Now I run protoc :
protoc --proto_path=. --objc_out=. newspaper.proto
protoc --proto_path=. --python_out=. newspaper.proto

Problem is, this makes my generated classes dependant on 
objectivec-descriptor.proto and descriptor.proto. To get the generated code to 
work I have to run:
protoc --proto_path=. --objc_out=. newspaper.proto 
/usr/include/google/protobuf/objectivec-descriptor.proto 
/usr/include/google/protobuf/descriptor.proto
protoc --proto_path=. --python_out=. newspaper.proto 
/usr/include/google/protobuf/objectivec-descriptor.proto 
/usr/include/google/protobuf/descriptor.proto

Now I have three source files for each language and code polluted with forward 
declarations, only to define an Objective C class prefix. Did I miss something 
or do I really have to depend on ObjectivecDescriptor.pb.h and Descriptor.pb.h?

I'm using the latest 2.2.0 trunk revision (r4423).

Original issue reported on code.google.com by spee...@gmail.com on 3 Aug 2010 at 11:14

GoogleCodeExporter commented 8 years ago
Yes.  This makes sense.  Without the objective-c descriptor there is no way for 
the system to know how to interpret this command "option 
(google.protobuf.objectivec_file_options).class_prefix = "LC";"

Original comment by cyrus.na...@gmail.com on 2 Nov 2010 at 5:24