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.
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
whereLANG
is the language you want. So--cpp_out
gives you C++ code, directory,--js_out
gives you JavaScript etc. Ifprotoc
doesn't recognizeLANG
then it looks for a plugin calledprotoc-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 usemylang
as LANG. Then theprotoc
invocation looks like: