chore: update protobuf * gRPC toolchains

This commit is contained in:
Nex 2020-09-22 16:21:24 +08:00
parent c331546099
commit bd3165747c
4 changed files with 22 additions and 29 deletions

View File

@ -11,17 +11,10 @@
- [Contract.ContractUnitRequestType](#bdware.bdledger.api.Contract.ContractUnitRequestType)
- [TransactionType](#bdware.bdledger.api.TransactionType)
- [bdware/bdledger/api/error_details.proto](#bdware/bdledger/api/error_details.proto)
- [InvalidArgument](#bdware.bdledger.api.InvalidArgument)
- [InvalidArgument.FieldViolation](#bdware.bdledger.api.InvalidArgument.FieldViolation)
- [bdware/bdledger/api/ledger.proto](#bdware/bdledger/api/ledger.proto)
- [CreateLedgerRequest](#bdware.bdledger.api.CreateLedgerRequest)
- [CreateLedgerResponse](#bdware.bdledger.api.CreateLedgerResponse)
@ -30,19 +23,13 @@
- [SendTransactionRequest.Transaction](#bdware.bdledger.api.SendTransactionRequest.Transaction)
- [SendTransactionResponse](#bdware.bdledger.api.SendTransactionResponse)
- [Ledger](#bdware.bdledger.api.Ledger)
- [bdware/bdledger/api/node.proto](#bdware/bdledger/api/node.proto)
- [ClientVersionResponse](#bdware.bdledger.api.ClientVersionResponse)
- [Node](#bdware.bdledger.api.Node)
- [bdware/bdledger/api/query.proto](#bdware/bdledger/api/query.proto)
- [BlockFilter](#bdware.bdledger.api.BlockFilter)
- [BlocksRequest](#bdware.bdledger.api.BlocksRequest)
@ -62,17 +49,11 @@
- [IncludeTransactions](#bdware.bdledger.api.IncludeTransactions)
- [Query](#bdware.bdledger.api.Query)
- [google/protobuf/empty.proto](#google/protobuf/empty.proto)
- [Empty](#google.protobuf.Empty)
- [Scalar Value Types](#scalar-value-types)

View File

@ -10,16 +10,28 @@ See [API documentation](..\docs\apis.md)
##### Installling tools
Download the [Protocol Buffers compiler](https://github.com/protocolbuffers/protobuf/releases) (protoc-3.11.4-*) for your platform and add `protoc` to `PATH` environment variable
Download the [Protocol Buffers compiler](https://github.com/protocolbuffers/protobuf/releases) (protoc-3.13.0-*) for your platform and add `protoc` to `PATH` environment variable
For generating Go code:
For generating Go code, install `protoc-gen-go` (v1.32.0):
```bash
GIT_TAG="v1.4.0"
go get -d -u github.com/golang/protobuf/protoc-gen-go
git -C "$(go env GOPATH)"/src/github.com/golang/protobuf checkout $GIT_TAG
go install github.com/golang/protobuf/protoc-gen-go
GIT_TAG="v1.32.0"
go get -d -u google.golang.org/protobuf/cmd/protoc-gen-go
git -C "$(go env GOPATH)"/src/google.golang.org/protobuf checkout $GIT_TAG
go install google.golang.org/protobuf/cmd/protoc-gen-go
```
(Update to google.golang.org/protobuf when https://github.com/grpc/grpc-go/pull/3435 resolves)
Also install `protoc-gen-go-grpc`:
```bash
go get -u google.golang.org/protobuf/cmd/protoc-gen-go
```
Or install using [gobin](https://github.com/myitcv/gobin):
```bash
gobin google.golang.org/protobuf/cmd/protoc-gen-go
gobin google.golang.org/grpc/cmd/protoc-gen-go-grpc
```
For generating HTTP JSON APIs with [grpc-gateway](https://grpc-ecosystem.github.io/grpc-gateway/), follow the [documentation](https://github.com/grpc-ecosystem/grpc-gateway/tree/v2#installation).
For generating Java code: From `bdledger-sdk-java` run `gradle generateProto`
@ -50,7 +62,7 @@ References:
Run:
```bash
./scripts/gen [-a, --async] [go] [nodejs] [ts] [docs]
./scripts/gen [-a, --async] [go] [gohttp] [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)

View File

@ -18,7 +18,7 @@ for %%A in (%*) do (
set out=%gen%\go
if not exist !out! mkdir !out!
echo Generating Go code
!exec! --go_out=plugins=grpc:!out! --govalidators_out=!out! %pbs%
!exec! --go-grpc_out=!out! --govalidators_out=!out! %pbs%
)
if "%%A"=="gohttp" (
set plugin=protoc-gen-grpc-gateway

View File

@ -46,7 +46,7 @@ do
mkdir -p $out
fi
echo "Generating Go code"
$exec --go_out=plugins=grpc:$out --govalidators_out=$out $pb_files $async_tag
$exec --go-grpc_out=$out --govalidators_out=$out $pb_files $async_tag
fi
if [ $aug == "gohttp" ]; then
plugin=protoc-gen-grpc-gateway