Update gen.bat with -a option
This commit is contained in:
parent
b866dc7fce
commit
51da6d60f4
@ -50,8 +50,9 @@ References:
|
|||||||
|
|
||||||
Run:
|
Run:
|
||||||
```bash
|
```bash
|
||||||
./scripts/gen [go] [nodejs] [ts]
|
./scripts/gen [-a, --async] [go] [nodejs] [ts] [docs]
|
||||||
```
|
```
|
||||||
|
Use `-a` or `--async` to speed up generation by asynchronously and concurrently generating all code and documentation (script will exit without waiting for completion)
|
||||||
|
|
||||||
#### Generateing documentation
|
#### Generateing documentation
|
||||||
|
|
||||||
@ -59,5 +60,5 @@ Install Go then run:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
|
go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
|
||||||
./scripts/gen docs
|
./scripts/gen [-a, --async] docs
|
||||||
```
|
```
|
||||||
|
@ -5,15 +5,18 @@ cd /d "%~dp0..\pb"
|
|||||||
where /q protoc || echo Missing protoc && exit /b
|
where /q protoc || echo Missing protoc && exit /b
|
||||||
set gen=..\gen
|
set gen=..\gen
|
||||||
set pbs=bdware/bdledger/api/*.proto
|
set pbs=bdware/bdledger/api/*.proto
|
||||||
|
set exec=protoc
|
||||||
|
|
||||||
for %%A in (%*) do (
|
for %%A in (%*) do (
|
||||||
|
if "%%A"=="-a" set exec=start /b protoc
|
||||||
|
if "%%A"=="--async" set exec=start /b protoc
|
||||||
if "%%A"=="go" (
|
if "%%A"=="go" (
|
||||||
set plugin=protoc-gen-go
|
set plugin=protoc-gen-go
|
||||||
where /q !plugin! || echo Missing !plugin! && exit /b
|
where /q !plugin! || echo Missing !plugin! && exit /b
|
||||||
set out=%gen%\go
|
set out=%gen%\go
|
||||||
if not exist !out! mkdir !out!
|
if not exist !out! mkdir !out!
|
||||||
echo Generating Go code
|
echo Generating Go code
|
||||||
start /b protoc --go_out=plugins=grpc:!out! %pbs%
|
!exec! --go_out=plugins=grpc:!out! %pbs%
|
||||||
)
|
)
|
||||||
if "%%A"=="nodejs" (
|
if "%%A"=="nodejs" (
|
||||||
set plugin=grpc_tools_node_protoc_plugin
|
set plugin=grpc_tools_node_protoc_plugin
|
||||||
@ -22,7 +25,7 @@ for %%A in (%*) do (
|
|||||||
set out=%gen%\nodejs
|
set out=%gen%\nodejs
|
||||||
if not exist !out! mkdir !out!
|
if not exist !out! mkdir !out!
|
||||||
echo Generating Node.js code
|
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
|
!exec! --js_out=import_style=commonjs,binary:!out! --grpc_out=!out! --plugin=protoc-gen-grpc=!pluginPath! %pbs% google/protobuf/empty.proto
|
||||||
)
|
)
|
||||||
if "%%A"=="ts" (
|
if "%%A"=="ts" (
|
||||||
set plugin=protoc-gen-ts
|
set plugin=protoc-gen-ts
|
||||||
@ -31,7 +34,7 @@ for %%A in (%*) do (
|
|||||||
set out=%gen%\nodejs
|
set out=%gen%\nodejs
|
||||||
if not exist !out! mkdir !out!
|
if not exist !out! mkdir !out!
|
||||||
echo Generating TypeScript definitions
|
echo Generating TypeScript definitions
|
||||||
start /b protoc --ts_out=!out! --plugin=protoc-gen-ts=!pluginPath! %pbs% google/protobuf/empty.proto
|
!exec! --ts_out=!out! --plugin=protoc-gen-ts=!pluginPath! %pbs% google/protobuf/empty.proto
|
||||||
)
|
)
|
||||||
if "%%A"=="docs" (
|
if "%%A"=="docs" (
|
||||||
set plugin=protoc-gen-ts
|
set plugin=protoc-gen-ts
|
||||||
@ -39,7 +42,7 @@ for %%A in (%*) do (
|
|||||||
set out=..\..\docs
|
set out=..\..\docs
|
||||||
if not exist !out! mkdir !out!
|
if not exist !out! mkdir !out!
|
||||||
echo Generating documentation
|
echo Generating documentation
|
||||||
start /b protoc --doc_out=!out! --doc_opt=html,apis.html %pbs% google/protobuf/empty.proto
|
!exec! --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=markdown,apis.md %pbs% google/protobuf/empty.proto
|
||||||
start /b protoc --doc_out=!out! --doc_opt=json,apis.json %pbs% google/protobuf/empty.proto
|
start /b protoc --doc_out=!out! --doc_opt=json,apis.json %pbs% google/protobuf/empty.proto
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user