-
-
Save christianchomiak/9d938c9271794b72a5f209ef2c726997 to your computer and use it in GitHub Desktop.
Batch file that creates the appropriate C++ code from a .proto file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
echo Generating API files... | |
:VARIABLES_DEFINITIONS | |
set PROTO_FILENAME=api | |
set SCRIPT_FOLDER=%cd% | |
set GRPC_BIN_ROOT=%SCRIPT_FOLDER%\bin | |
set OUTPUT_DIRECTORY=%SCRIPT_FOLDER%\api_cpp | |
:CHECK_GRPC_BINARIES | |
IF "%GRPC_BIN_ROOT%" == "" (echo "Could not find the gRPC binaries" && GOTO ABORT) | |
:CREATE_OUTPUT_DIRECTORY | |
IF EXIST %OUTPUT_DIRECTORY% (rd /s /q %OUTPUT_DIRECTORY%) | |
md %OUTPUT_DIRECTORY% | |
:CREATE_API | |
call %GRPC_BIN_ROOT%\protoc --proto_path=%SCRIPT_FOLDER% --grpc_out=%OUTPUT_DIRECTORY% --plugin=protoc-gen-grpc=%GRPC_BIN_ROOT%/grpc_cpp_plugin.exe %PROTO_FILENAME%.proto | |
call %GRPC_BIN_ROOT%\protoc --proto_path=%SCRIPT_FOLDER% --cpp_out=%OUTPUT_DIRECTORY% %PROTO_FILENAME%.proto | |
REM SUCCESS! | |
GOTO GRACEFULEXIT | |
:ABORT | |
pause | |
echo Aborted... | |
:GRACEFULEXIT | |
echo API creation done! | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment