Reputation: 1236
I am undergoing trouble writing the custom protoc plugin. I posted this question but no response. Atleast Kindly please let me know answers to few questions. I really need to do this. I havent gone past first step itself.
From this question, how do they link shell script with plugin name protoc-gen-code.
java -cp ./codegen.jar CodeGeneratorMain "$@"
With respect to the above implementation in the question and google proto buffer documentation, what exactly would be there in the path.. is it the path of the Shell Script? would the shell script be named as protoc-gen-code?
Can someone please respond to these queries.
Upvotes: 0
Views: 308
Reputation: 8204
protoc
can generate code for several different languages with one invocation. The way you specify which languages you want is to use the command line arguments of the form --LANG_out
where LANG
is the language you want. So --cpp_out
gives you C++ code, directory, --js_out
gives you JavaScript etc. If protoc
doesn't recognize LANG
then it looks for a plugin called protoc-gen-LANG
and uses it as the code generator.
The shell script can be called whatever. Let's say you call it mygen.sh
and you decide you want to use mylang
as LANG. Then the protoc
invocation looks like:
protoc --plugin=protoc-gen-mylang=/path/to/mygen.sh --mylang_out=/some/dir some.proto
Upvotes: 0