I have some .proto files used to compile classes from Java, C++ and C#. For Java and C++ I use the Protoc compiler and for the C# I use Protogen. The scripts for the Java/C++ class creation is
@ECHO OFF
SET SRC_DIR=%~dp0
REM Make Java and C++
SET JAVA_OUT_DIR=%SRC_DIR%\..\taurus-messages-java\src\main\java
if not exist %JAVA_OUT_DIR% (
mkdir %JAVA_OUT_DIR%
)
SET CPP_OUT_DIR=%SRC_DIR%\..\taurus-messages-cpp
if not exist %CPP_OUT_DIR% (
mkdir %CPP_OUT_DIR%
)
protoc -I=%SRC_DIR% --java_out=%JAVA_OUT_DIR% --cpp_out=%CPP_OUT_DIR% %SRC_DIR%taurus-mux.proto
protoc -I=%SRC_DIR% --java_out=%JAVA_OUT_DIR% --cpp_out=%CPP_OUT_DIR% %SRC_DIR%taurus-backtest.proto
and for the C# class generation I have
@ECHO OFF
SET WORK_DIR=%~dp0
SET OUT_DIR=%WORK_DIR%\Messages
SET SRC_DIR=%WORK_DIR%\..\..\..\Taurus\trunk\taurus-messages-proto\
if not exist %OUT_DIR% (
mkdir %OUT_DIR%
)
cd %SRC_DIR%
protogen -p:detectMissing -i:taurus-backtest.proto -o:%OUT_DIR%\TaurusBacktest.cs
protogen -p:detectMissing -i:taurus-mux.proto -o:%OUT_DIR%\TaurusMux.cs
cd %WORK_DIR%
both script reference the .proto files (of course ;]). I the above C# script I have added -p:detectMissing
in order to generate properties that allow me to test whether or not a field is specified; the option creates *Specified
for all fields where IsRequired = false
.
My question is simple, I want to make sure the C#, C++ and Java classes remain aligned, but for C# I need to use -p:detectMissing
option with Protogen, what is the equivalent option using Protoc?
Thanks for your time.