protobuf-objc icon indicating copy to clipboard operation
protobuf-objc copied to clipboard

Are packages and options available?

Open lolgear opened this issue 8 years ago • 8 comments

Not sure if it is a bug or my dirty hands, but..

I followed these steps:

  1. brew install protobuf
  2. git clone <this repo>
  3. ./scripts/build.sh
  4. fill up all needed information for proto files.
  5. ( somewhere between previous steps: link 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

    package ponyprotobuffed;

    import "objectivec-descriptor.proto";
    option (google.protobuf.objectivec_file_options).package = "PonyProtobuffed";
    option (google.protobuf.objectivec_file_options).class_prefix = "PNP";
    option (google.protobuf.objectivec_file_options).relax_camel_case = true;

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.

enum PNPPonyProtobuffedPonyType {
   Cute
   Awesome
}

message Pony {
    required PNPPonyProtobuffedPonyType ponyType = 2 [default = PNPPonyProtobuffedPonyTypeCute]
}

Unknown value PNPPonyProtobuffedPonyTypeCute or Cute.

lolgear avatar Jun 02 '16 13:06 lolgear