Hi there,

I'm implementing a protoc plugin for PHP and Javascript. The design of the
protoc plugin system is great once you understand it :)

By reading the source code of protoc I've noticed that it's already possible
to pass options to the plugins by appending them to the --lang_out argument.
Anything before the path separator ":" will be included as a string in the
"parameter" field of CodeGeneratorRequest. Like in the following example:

  protoc --php_out="option=value:./destination_path" tutorial.proto

The problem with this syntax is that it's a bit limited (not possible to
include colons ":" in the arguments) and then it's quite difficult for a
human to use it. I've worked around this by creating a wrapper shell script
for protoc that converts --lang-optname options to an url encoded string for
use with the --lang_out option.

However I feel that it'll be a great addition if protoc could do this
natively, running the plugin command with any extra options given. Example:

  protoc --php_out=./destination_path --php-verbose --php-optimize=size
--php-header=./header.txt

That execution would make protoc run the protoc-gen-php plugin the following
way:

  protoc-gen-php --verbose --optimize=size --header=./header.txt

Note that since plugins options are prefixed by the plugin name, it's
compatible with having several plugins defined.


regards,
/imv

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

Reply via email to