diff options
author | Jisi Liu <jisi.liu@gmail.com> | 2016-10-25 17:43:59 -0700 |
---|---|---|
committer | Jisi Liu <jisi.liu@gmail.com> | 2016-10-25 17:43:59 -0700 |
commit | 59cd5d0e26c180117d9d5fe16be536e63d29e332 (patch) | |
tree | 39f93cc85796962cc78ccd72eed1fc017b43fda4 /src/google/protobuf/compiler/command_line_interface.h | |
parent | 58580da37357941d502805be3ae520441be77728 (diff) |
Support extra parameters for plugins.
Diffstat (limited to 'src/google/protobuf/compiler/command_line_interface.h')
-rw-r--r-- | src/google/protobuf/compiler/command_line_interface.h | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/google/protobuf/compiler/command_line_interface.h b/src/google/protobuf/compiler/command_line_interface.h index c38e65a3..d779fc87 100644 --- a/src/google/protobuf/compiler/command_line_interface.h +++ b/src/google/protobuf/compiler/command_line_interface.h @@ -146,14 +146,14 @@ class LIBPROTOC_EXPORT CommandLineInterface { // plugin [--out=OUTDIR] [--parameter=PARAMETER] PROTO_FILES < DESCRIPTORS // --out indicates the output directory (as passed to the --foo_out // parameter); if omitted, the current directory should be used. --parameter - // gives the generator parameter, if any was provided. The PROTO_FILES list - // the .proto files which were given on the compiler command-line; these are - // the files for which the plugin is expected to generate output code. - // Finally, DESCRIPTORS is an encoded FileDescriptorSet (as defined in - // descriptor.proto). This is piped to the plugin's stdin. The set will - // include descriptors for all the files listed in PROTO_FILES as well as - // all files that they import. The plugin MUST NOT attempt to read the - // PROTO_FILES directly -- it must use the FileDescriptorSet. + // gives the generator parameter, if any was provided (see below). The + // PROTO_FILES list the .proto files which were given on the compiler + // command-line; these are the files for which the plugin is expected to + // generate output code. Finally, DESCRIPTORS is an encoded FileDescriptorSet + // (as defined in descriptor.proto). This is piped to the plugin's stdin. + // The set will include descriptors for all the files listed in PROTO_FILES as + // well as all files that they import. The plugin MUST NOT attempt to read + // the PROTO_FILES directly -- it must use the FileDescriptorSet. // // The plugin should generate whatever files are necessary, as code generators // normally do. It should write the names of all files it generates to @@ -161,6 +161,13 @@ class LIBPROTOC_EXPORT CommandLineInterface { // names or relative to the current directory. If any errors occur, error // messages should be written to stderr. If an error is fatal, the plugin // should exit with a non-zero exit code. + // + // Plugins can have generator parameters similar to normal built-in + // generators. Extra generator parameters can be passed in via a matching + // "_opt" parameter. For example: + // protoc --plug_out=enable_bar:outdir --plug_opt=enable_baz + // This will pass "enable_bar,enable_baz" as the parameter to the plugin. + // void AllowPlugins(const string& exe_name_prefix); // Run the Protocol Compiler with the given command-line parameters. @@ -316,6 +323,8 @@ class LIBPROTOC_EXPORT CommandLineInterface { // protoc --foo_out=outputdir --foo_opt=enable_bar ... // Then there will be an entry ("--foo_out", "enable_bar") in this map. map<string, string> generator_parameters_; + // Similar to generator_parameters_, but stores the parameters for plugins. + map<string, string> plugin_parameters_; // See AllowPlugins(). If this is empty, plugins aren't allowed. string plugin_prefix_; |