-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Are packages and options available? #83
Comments
The obj-c options like class prefix are added only for the generated obj-c code. So in your protobuf definitions, if you define:
The generated obj-c code will be:
The obj-c definitions only effect obj-c code generation because they're specific to the idiosyncratic way that people expect obj-c code to be written. If you want the class prefix to be global for all code generation across, say C++ or go, you need to add that yourself in the proto definitions. |
@E-B-Smith For example, there are two files: I want to generate files with prefix PNP and in package PonyProtobuffed. files are ponyEnums.proto
pony.proto
Now they would be generated without any prefix. UPD: question about scattered enums. if several enums are specified as properties in different messages, how they should be declared in different .proto files? In my example it should be, for example, PonyLover message with pony type. ponyLover.proto
Should I duplicate declaration of ponyType in each .proto file where it needed? UPD2: I see something interesting: |
The options should be the header in each of your proto files. Also, you can import PonyEnums.proto in your Pony.Proto file: Pony.proto:
|
Also, the "objectivec-descriptor.proto" describes the obj-c extensions to protobuf and isn't part of your project. |
yes, thanks, latest bug that still exists:
It lays somewhere depths of protobuf-objc: If I try to linked it via |
(This answer was updated with more info.) Here's an example project that builds the Pony protobuf. You can download and try it out: Executing the script 'make-ponies' will make obj-c and go files (as a cross compile example) and place the source files in the 'Build' folder. Here's the PrettyPonies project folder layout:
Here's the bash compile script:
|
Could you make PR as a result of this confusing issue? ( Maybe description in readme and another example project ) |
The unexpected project file locations are needed so that the java cross compile works. Java expects files in particular places and is pretty inflexible about file locations. Good luck with your project! |
Not sure if it is a bug or my dirty hands, but..
I followed these steps:
brew install protobuf
git clone <this repo>
./scripts/build.sh
protoc
to correct folder/usr/local/bin
)( Also I added project via cocoapods, but it doesn't matter )
Ok, I try to run
protoc --plugin=/usr/local/bin/protoc-gen-objc *.proto --objc_out="./"
Several issues appeared.
First: Can't use options
No luck with class prefix or package.
These options not found.
File "objectvicec-descriptor.proto" not found.
If I remove all options and leave only
option class_prefix="PNP"
or
option objc_class_prefix="PNP"
result is the same - no luck.
package doesn't work well (names aren't prefixed by package name).
Second: Can't use default value for enum.
Unknown value
PNPPonyProtobuffedPonyTypeCute
orCute
.The text was updated successfully, but these errors were encountered: