Re: [protobuf] How to handle options in compiler plugin?

2018-08-31 Thread 'Feng Xiao' via Protocol Buffers
On Thu, Aug 30, 2018 at 4:14 PM Ankit Patel 
wrote:

> Hi Kenton,
>
> I am trying to do something similiar. I am writing a java plugin and I
> have defined my custom service options and method options but inside my
> plugin I see I only have access to FileDescriptorProto and not the
> FileDescriptor itself. when I try to access these options as you just
> suggested from the FileDecriptorProto they are null.
>
Link the option definitions into your plugin, and when parsing
CodeGeneratorRequest in your plugin, use an ExtensionRegistry with all
option definitions registered. After that you should be able to get
FileDescriptorProtos with option values.

To get FileDescriptor, you will need to call FileDescriptor.buildFile()
yourself.


> Please recommend on what is the suggested solution to make this work.
> Thanks
>
> On Tuesday, April 20, 2010 at 5:53:37 PM UTC-7, Kenton Varda wrote:
>>
>> You do not need to compile your option declarations into protoc.  You
>> only need to compile them into your plugin binary.  Files which use your
>> options must import the .proto file that defines them.  protoc will then
>> parse the option definitions dynamically.
>>
>> For example, you could create a file php_options.proto:
>>
>>   import "google/protobuf/descriptor.proto";
>>
>>   package protobuf_php;
>>
>>   message PhpFileOptions {
>> optional bool skip_unknown = 1;
>> optional string namespace = 2;
>>   }
>>
>>   extend google.protobuf.FileOptions {
>> optional PhpFieldOptions file_opt = 1004;
>>   }
>>
>> Now users could do:
>>
>>   import "php_options.proto"
>>
>>   option (protobuf_php.file_opt.skip_unknown) = true;
>>   option (protobuf_php.file_opt.namespace) = "My/Namespace";
>>
>> In your plugin, you can read these options like:
>>
>>
>>   
>> file_descriptor->options().GetExtension(protobuf_php::file_opt).skip_unknown()
>>
>> Note that the number 1004 above is a number that I have assigned
>> specifically to you!  Usually people have to e-mail me to request these (as
>> the comments in descriptor.proto say), but rather than wait for you to
>> actually do so I went ahead and assigned you a number.  Note that you can
>> also define other kinds of options (e.g. field options); use extension
>> number 1004 for these as well.  Please let me know your project URL once it
>> has one so that I can keep track of it.
>>
>> On Tue, Apr 20, 2010 at 3:08 PM, Andrew Brampton 
>> wrote:
>>
>>> 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 
>>> 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 
>>> 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 prot..

Re: [protobuf] How to handle options in compiler plugin?

2018-08-30 Thread Ankit Patel
Hi Kenton,

I am trying to do something similiar. I am writing a java plugin and I have 
defined my custom service options and method options but inside my plugin I 
see I only have access to FileDescriptorProto and not the FileDescriptor 
itself. when I try to access these options as you just suggested from the 
FileDecriptorProto they are null. Please recommend on what is the suggested 
solution to make this work. Thanks

On Tuesday, April 20, 2010 at 5:53:37 PM UTC-7, Kenton Varda wrote:
>
> You do not need to compile your option declarations into protoc.  You only 
> need to compile them into your plugin binary.  Files which use your options 
> must import the .proto file that defines them.  protoc will then parse the 
> option definitions dynamically.
>
> For example, you could create a file php_options.proto:
>
>   import "google/protobuf/descriptor.proto";
>
>   package protobuf_php;
>
>   message PhpFileOptions {
> optional bool skip_unknown = 1;
> optional string namespace = 2;
>   }
>
>   extend google.protobuf.FileOptions {
> optional PhpFieldOptions file_opt = 1004;
>   }
>
> Now users could do:
>
>   import "php_options.proto"
>
>   option (protobuf_php.file_opt.skip_unknown) = true;
>   option (protobuf_php.file_opt.namespace) = "My/Namespace";
>
> In your plugin, you can read these options like:
>
>
>   
> file_descriptor->options().GetExtension(protobuf_php::file_opt).skip_unknown()
>
> Note that the number 1004 above is a number that I have assigned 
> specifically to you!  Usually people have to e-mail me to request these (as 
> the comments in descriptor.proto say), but rather than wait for you to 
> actually do so I went ahead and assigned you a number.  Note that you can 
> also define other kinds of options (e.g. field options); use extension 
> number 1004 for these as well.  Please let me know your project URL once it 
> has one so that I can keep track of it.
>
> On Tue, Apr 20, 2010 at 3:08 PM, Andrew Brampton  > wrote:
>
>> 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 > > 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 > > 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 prot...@googlegroups.com 
>> .
>> >> To unsubscribe from this group, send email to
>> >> protobuf+u...@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 prot...@googlegroups.com 
> .
> To unsubscribe from this group, send email to 
> protobuf+u...@googlegroups.com 

Re: [protobuf] How to handle options in compiler plugin?

2010-04-20 Thread Andrew Brampton
Thanks to both Jason and Kenton you have made this a lot clearer to me now!

and thanks for the reserved number 1004, when I make a site for this
project I'll send you the email.

Andrew

On Wed, Apr 21, 2010 at 1:53 AM, Kenton Varda  wrote:
> You do not need to compile your option declarations into protoc.  You only
> need to compile them into your plugin binary.  Files which use your options
> must import the .proto file that defines them.  protoc will then parse the
> option definitions dynamically.
> For example, you could create a file php_options.proto:
>   import "google/protobuf/descriptor.proto";
>   package protobuf_php;
>   message PhpFileOptions {
>     optional bool skip_unknown = 1;
>     optional string namespace = 2;
>   }
>   extend google.protobuf.FileOptions {
>     optional PhpFieldOptions file_opt = 1004;
>   }
> Now users could do:
>   import "php_options.proto"
>   option (protobuf_php.file_opt.skip_unknown) = true;
>   option (protobuf_php.file_opt.namespace) = "My/Namespace";
> In your plugin, you can read these options like:
>   file_descriptor->options().GetExtension(protobuf_php::file_opt).skip_unknown()
> Note that the number 1004 above is a number that I have assigned
> specifically to you!  Usually people have to e-mail me to request these (as
> the comments in descriptor.proto say), but rather than wait for you to
> actually do so I went ahead and assigned you a number.  Note that you can
> also define other kinds of options (e.g. field options); use extension
> number 1004 for these as well.  Please let me know your project URL once it
> has one so that I can keep track of it.
> On Tue, Apr 20, 2010 at 3:08 PM, Andrew Brampton  wrote:
>>
>> 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  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 
>> > 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.



Re: [protobuf] How to handle options in compiler plugin?

2010-04-20 Thread Kenton Varda
You do not need to compile your option declarations into protoc.  You only
need to compile them into your plugin binary.  Files which use your options
must import the .proto file that defines them.  protoc will then parse the
option definitions dynamically.

For example, you could create a file php_options.proto:

  import "google/protobuf/descriptor.proto";

  package protobuf_php;

  message PhpFileOptions {
optional bool skip_unknown = 1;
optional string namespace = 2;
  }

  extend google.protobuf.FileOptions {
optional PhpFieldOptions file_opt = 1004;
  }

Now users could do:

  import "php_options.proto"

  option (protobuf_php.file_opt.skip_unknown) = true;
  option (protobuf_php.file_opt.namespace) = "My/Namespace";

In your plugin, you can read these options like:

  file_descriptor->options().GetExtension(protobuf_php::file_opt).skip_unknown()

Note that the number 1004 above is a number that I have assigned
specifically to you!  Usually people have to e-mail me to request these (as
the comments in descriptor.proto say), but rather than wait for you to
actually do so I went ahead and assigned you a number.  Note that you can
also define other kinds of options (e.g. field options); use extension
number 1004 for these as well.  Please let me know your project URL once it
has one so that I can keep track of it.

On Tue, Apr 20, 2010 at 3:08 PM, Andrew Brampton  wrote:

> 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  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 
> 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.



Re: [protobuf] How to handle options in compiler plugin?

2010-04-20 Thread Jason Hsueh
Your options extensions can live in a .proto file in the location of your
choosing. protoc doesn't need to know about your options: it will simply
parse the options into the UninterpretedOptions message. Then in the .proto
files where you want to use your options, you need to put the option names
in parentheses to indicate that they are extensions, not regular fields
defined within FileOptions:
option (php_namespace) = "...";

On Tue, Apr 20, 2010 at 3:08 PM, Andrew Brampton  wrote:

> 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  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 
> 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.
>
>

-- 
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.



Re: [protobuf] How to handle options in compiler plugin?

2010-04-20 Thread Andrew Brampton
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  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  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.



Re: [protobuf] How to handle options in compiler plugin?

2010-04-20 Thread Kenton Varda
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  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.



[protobuf] How to handle options in compiler plugin?

2010-04-20 Thread Andrew Brampton
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.