Upgrade to https://blog.golang.org/protobuf-apiv2
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
@echo off
|
||||
cd /d "%~dp0.."
|
||||
set dir=.\gen\go
|
||||
set exe=protoc
|
||||
set gen=protoc-gen-go
|
||||
|
||||
if defined GOPATH set PATH=%PATH%;%GOPATH%\bin
|
||||
|
||||
where /q %exe% || echo missing %exe% && exit /B
|
||||
where /q %gen% || echo missing %gen% && exit /B
|
||||
|
||||
if not exist %dir% mkdir %dir%
|
||||
%exe% -I . --go_out=plugins=grpc:%dir% bdledger/api/common.proto
|
||||
%exe% -I . --go_out=plugins=grpc:%dir% bdledger/api/error_details.proto
|
||||
%exe% -I . --go_out=plugins=grpc:%dir% bdledger/api/node.proto
|
||||
%exe% -I . --go_out=plugins=grpc:%dir% bdledger/api/ledger.proto
|
||||
%exe% -I . --go_out=plugins=grpc:%dir% bdledger/api/query.proto
|
||||
%exe% -I . --go_out=plugins=grpc:%dir% bdledger/api/contract.proto
|
||||
|
||||
echo all done
|
||||
@@ -1,20 +0,0 @@
|
||||
@echo off
|
||||
cd /d "%~dp0.."
|
||||
set dir=.\gen\nodejs
|
||||
set exe=grpc_tools_node_protoc
|
||||
set plugin=grpc_tools_node_protoc_plugin
|
||||
|
||||
where /q %exe% || echo missing %exe% && exit /B
|
||||
where /q %plugin% || echo missing %plugin% && exit /B
|
||||
|
||||
for /f %%i in ('where %plugin%') do set pluginPath=%%i
|
||||
|
||||
if not exist %dir% mkdir %dir%
|
||||
call %exe% -I . --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%pluginPath% bdledger/api/common.proto
|
||||
call %exe% -I . --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%pluginPath% bdledger/api/error_details.proto
|
||||
call %exe% -I . --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%pluginPath% bdledger/api/node.proto
|
||||
call %exe% -I . --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%pluginPath% bdledger/api/ledger.proto
|
||||
call %exe% -I . --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%pluginPath% bdledger/api/query.proto
|
||||
call %exe% -I . --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%pluginPath% bdledger/api/contract.proto
|
||||
|
||||
echo all done
|
||||
37
scripts/gen.bat
Normal file
37
scripts/gen.bat
Normal file
@@ -0,0 +1,37 @@
|
||||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
cd /d "%~dp0.."
|
||||
where /q protoc || echo Missing protoc && exit /b
|
||||
set gen=.\gen
|
||||
set pkg=bdware/bdledger/api
|
||||
set protos=%pkg%/common.proto %pkg%/error_details.proto %pkg%/node.proto %pkg%/ledger.proto %pkg%/query.proto %pkg%/contract.proto
|
||||
|
||||
for %%A in (%*) do (
|
||||
if "%%A"=="go" (
|
||||
set plugin=protoc-gen-go
|
||||
where /q !plugin! || echo Missing !plugin! && exit /b
|
||||
set out=%gen%\go
|
||||
if not exist !out! mkdir !out!
|
||||
echo Generating Go code
|
||||
start /b protoc --go_out=plugins=grpc:!out! %protos%
|
||||
)
|
||||
if "%%A"=="nodejs" (
|
||||
set plugin=grpc_tools_node_protoc_plugin
|
||||
where /q !plugin! || echo missing !plugin! && exit /b
|
||||
for /f %%i in ('where !plugin!') do set pluginPath=%%i
|
||||
set out=%gen%\nodejs
|
||||
if not exist !out! mkdir !out!
|
||||
echo Generating Node.js code
|
||||
start /b protoc --js_out=import_style=commonjs,binary:!nout! --grpc_out=!nout! --plugin=protoc-gen-grpc=!pluginPath! %protos%
|
||||
)
|
||||
if "%%A"=="ts" (
|
||||
set plugin=protoc-gen-ts
|
||||
where /q !plugin! || echo missing !plugin! && exit /B
|
||||
for /f %%i in ('where !plugin!') do set pluginPath=%%i
|
||||
set out=%gen%\nodejs
|
||||
if not exist !out! mkdir !out!
|
||||
echo Generating TypeScript definitions
|
||||
start /b protoc --ts_out=!out! --plugin=protoc-gen-ts=!pluginPath! %protos%
|
||||
)
|
||||
)
|
||||
5
scripts/gen.sh
Normal file
5
scripts/gen.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd "${0%/*}/.."
|
||||
|
||||
# TODO
|
||||
Reference in New Issue
Block a user