Merge pull request #569 from wilmerpaulino/protobuf-docs

docs: clarify how to generate protobuf definitions
This commit is contained in:
Olaoluwa Osuntokun 2018-01-27 18:43:12 -08:00 committed by GitHub
commit 859ecbd300
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 0 deletions

@ -356,6 +356,9 @@ generate identical compiled protos and related files:
* grpc-ecosystem/grpc-gateway: `f2862b476edcef83412c7af8687c9cd8e4097c0f`
* golang/protobuf: `ab9f9a6dab164b7d1246e0e688b0ab7b94d8553e`
For detailed instructions on how to compile modifications to `lnd`'s `protobuf`
definitions, check out the [lnrpc README](https://github.com/lightningnetwork/lnd/blob/master/lnrpc/README.md).
Additionally, in order to maintain a uniform display of the RPC responses
rendered by `lncli`, all added or modified `protof` definitions, _must_ attach
the proper `json_name` option for all fields. An example of such an option can

@ -132,3 +132,32 @@ description):
```bash
$ go get -u github.com/lightningnetwork/lnd/lnrpc
```
## Generate protobuf definitions
1. Download [v.3.4.0](https://github.com/google/protobuf/releases/tag/v3.4.0) of
`protoc` for your operating system and add it to your `PATH`.
For example, if using macOS:
```bash
$ curl -LO https://github.com/google/protobuf/releases/download/v3.4.0/protoc-3.4.0-osx-x86_64.zip
$ unzip protoc-3.4.0-osx-x86_64.zip -d protoc
$ export PATH=$PWD/protoc/bin:$PATH
```
2. Install `golang/protobuf` at commit `ab9f9a6dab164b7d1246e0e688b0ab7b94d8553e`.
```bash
$ git clone https://github.com/golang/protobuf $GOPATH/src/github.com/golang/protobuf
$ cd $GOPATH/src/github.com/golang/protobuf
$ git reset --hard ab9f9a6dab164b7d1246e0e688b0ab7b94d8553e
$ make
```
3. Install `grpc-ecosystem/grpc-gateway` at commit `f2862b476edcef83412c7af8687c9cd8e4097c0f`.
```bash
$ git clone https://github.com/grpc-ecosystem/grpc-gateway $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway
$ cd $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway
$ git reset --hard f2862b476edcef83412c7af8687c9cd8e4097c0f
$ go install ./protoc-gen-grpc-gateway ./protoc-gen-swagger
```
4. Run `gen_protos.sh` to generate new protobuf definitions.