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

@@ -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)