Thanks for your reply Kenton,

I've been going round in circles with the documentation but completely
missed the section on custom options. Ok, so that has helped a little
but I'm still not sure how to apply it. So here is some more
information. I have the sample addressbook.proto file and at the top
it has a couple of options:

option java_package = "com.example.tutorial";
option java_outer_classname = "AddressBookProtos";

All I want to do is add another line like so:

option php_skip_unknown = true;
or something like:
option php_namespace = "My/Namespace";

Which, in the first case, would tell my compiler to skip over unknown
fields instead of storing them, and the second put the generated files
in a particular namespace.

Now I see from the documentation I can extend FileOptions, but where
do I save the proto file with my new options in it? Would I need to
recompile the protoc compiler? At the moment I'm using protoc
installed from apt, and giving it the following command line:

protoc --php_out . --plugin=protoc-gen-php=./protoc-gen-php my.proto

Thanks for any guidance you can give me.
Andrew

On Tue, Apr 20, 2010 at 10:38 PM, Kenton Varda <ken...@google.com> wrote:
> It sounds like you are using custom options incorrectly, independent of your
> plugin.  That error message is being produced by protoc before it even tries
> to call your plugin.  Please double-check the docs on custom options.  If
> you can't figure out what's wrong, show us the .proto code you are using to
> define and then use your option.
>
> On Tue, Apr 20, 2010 at 4:24 AM, Andrew Brampton <bramp...@gmail.com> wrote:
>>
>> Hi,
>> I've nearly finished writing a compiler plugin for generating PHP
>> code. I now wanted to support some additional options. However, I'm
>> not sure how to begin. When I have a custom option in my proto file,
>> protoc seems to die with this error:
>>
>> my.proto:2:8: Option "php_skip_unknown" unknown.
>>
>> This seems to happen before CodeGenerator's generate method is called.
>> So I'm not sure how I handle this.
>>
>> Also, are there some test proto files, with binary data, which I can
>> use to fully validate my compiler?
>>
>> thanks
>> Andrew
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Protocol Buffers" group.
>> To post to this group, send email to proto...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> protobuf+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/protobuf?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to