Restructure project
This commit is contained in:
11
grpc/scripts/gen-go.sh
Normal file
11
grpc/scripts/gen-go.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
cd "${0%/*}/.."
|
||||
dir=gen/nodejs
|
||||
mkdir -p $dir
|
||||
protoc -I . --go_out=plugins=grpc:$dir bdledger/api/common.proto
|
||||
protoc -I . --go_out=plugins=grpc:$dir bdledger/api/error_details.proto
|
||||
protoc -I . --go_out=plugins=grpc:$dir bdledger/api/node.proto
|
||||
protoc -I . --go_out=plugins=grpc:$dir bdledger/api/ledger.proto
|
||||
protoc -I . --go_out=plugins=grpc:$dir bdledger/api/query.proto
|
||||
protoc -I . --go_out=plugins=grpc:$dir bdledger/api/contract.proto
|
||||
|
||||
11
grpc/scripts/gen-node.js.sh
Normal file
11
grpc/scripts/gen-node.js.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
cd "${0%/*}/.."
|
||||
dir=gen/nodejs
|
||||
pluginPath=$(which grpc_tools_node_protoc_plugin)
|
||||
mkdir -p $dir
|
||||
protoc -I . --js_out=import_style=commonjs,binary:$dir --grpc_out=$dir --plugin=protoc-gen-grpc="$pluginPath" bdledger/api/common.proto
|
||||
protoc -I . --js_out=import_style=commonjs,binary:$dir --grpc_out=$dir --plugin=protoc-gen-grpc="$pluginPath" bdledger/api/error_details.proto
|
||||
protoc -I . --js_out=import_style=commonjs,binary:$dir --grpc_out=$dir --plugin=protoc-gen-grpc="$pluginPath" bdledger/api/node.proto
|
||||
protoc -I . --js_out=import_style=commonjs,binary:$dir --grpc_out=$dir --plugin=protoc-gen-grpc="$pluginPath" bdledger/api/ledger.proto
|
||||
protoc -I . --js_out=import_style=commonjs,binary:$dir --grpc_out=$dir --plugin=protoc-gen-grpc="$pluginPath" bdledger/api/query.proto
|
||||
protoc -I . --js_out=import_style=commonjs,binary:$dir --grpc_out=$dir --plugin=protoc-gen-grpc="$pluginPath" bdledger/api/contract.proto
|
||||
18
grpc/scripts/gen-web.bat
Normal file
18
grpc/scripts/gen-web.bat
Normal file
@@ -0,0 +1,18 @@
|
||||
@echo off
|
||||
cd /d "%~dp0.."
|
||||
set dir=.\gen\web
|
||||
set exe=protoc
|
||||
set gen=protoc-protoc-gen-grpc-web
|
||||
|
||||
where /q %exe% || echo missing %exe% && exit /B
|
||||
where /q %gen% || echo missing %gen% && exit /B
|
||||
|
||||
if not exist %dir% mkdir %dir%
|
||||
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdledger/api/common.proto
|
||||
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdledger/api/error_details.proto
|
||||
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdledger/api/node.proto
|
||||
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdledger/api/ledger.proto
|
||||
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdledger/api/query.proto
|
||||
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdledger/api/contract.proto
|
||||
|
||||
echo all done
|
||||
10
grpc/scripts/gen-web.sh
Normal file
10
grpc/scripts/gen-web.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
cd "${0%/*}/.."
|
||||
dir=gen/web
|
||||
mkdir -p $dir
|
||||
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdledger/api/common.proto
|
||||
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdledger/api/error_details.proto
|
||||
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdledger/api/node.proto
|
||||
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdledger/api/ledger.proto
|
||||
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdledger/api/query.proto
|
||||
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdledger/api/contract.proto
|
||||
47
grpc/scripts/gen.bat
Normal file
47
grpc/scripts/gen.bat
Normal file
@@ -0,0 +1,47 @@
|
||||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
cd /d "%~dp0..\pb"
|
||||
where /q protoc || echo Missing protoc && exit /b
|
||||
set gen=..\gen
|
||||
set pbs=bdware/bdledger/api/*.proto
|
||||
REM 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! %pbs%
|
||||
)
|
||||
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:!out! --grpc_out=!out! --plugin=protoc-gen-grpc=!pluginPath! %pbs% google/protobuf/empty.proto
|
||||
)
|
||||
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! %pbs% google/protobuf/empty.proto
|
||||
)
|
||||
if "%%A"=="docs" (
|
||||
set plugin=protoc-gen-ts
|
||||
where /q !plugin! || echo missing !plugin! && exit /B
|
||||
set out=..\..\docs
|
||||
if not exist !out! mkdir !out!
|
||||
echo Generating documentation
|
||||
start /b protoc --doc_out=!out! --doc_opt=html,apis.html %pbs% google/protobuf/empty.proto
|
||||
start /b protoc --doc_out=!out! --doc_opt=markdown,apis.md %pbs% google/protobuf/empty.proto
|
||||
start /b protoc --doc_out=!out! --doc_opt=json,apis.json %pbs% google/protobuf/empty.proto
|
||||
)
|
||||
)
|
||||
5
grpc/scripts/gen.sh
Normal file
5
grpc/scripts/gen.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd "${0%/*}/.."
|
||||
|
||||
# TODO
|
||||
Reference in New Issue
Block a user