From f5651d2b616cd1c0cabed42e298fa605cf05e216 Mon Sep 17 00:00:00 2001 From: Marko Date: Mon, 30 Mar 2020 16:48:48 +0200 Subject: [PATCH] proto: use docker to generate stubs (#4615) * proto: use docker to generate stubs - provide an option to developers to use docker to generate proto stubs closes #4579 Signed-off-by: Marko Baricevic --- CHANGELOG_PENDING.md | 3 ++- CONTRIBUTING.md | 5 ++++- Makefile | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 44354b5c6..4ec4db785 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -22,7 +22,8 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi - [privval] \#4534 Add `error` as a return value on`GetPubKey()` - [Docker] \#4569 Default configuration added to docker image (you can still mount your own config the same way) (@greg-szabo) - [lite2] [\#4562](https://github.com/tendermint/tendermint/pull/4562) Cache headers when using bisection (@cmwaters) -- [all] [\4608](https://github.com/tendermint/tendermint/pull/4608) Give reactors descriptive names when they're initialized +- [all] [\#4608](https://github.com/tendermint/tendermint/pull/4608) Give reactors descriptive names when they're initialized +- [tools] \#4615 Allow developers to use Docker to generate proto stubs, via `make proto-gen-docker`. ### BUG FIXES: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index db4302056..e057c32a8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -105,7 +105,10 @@ We use [Protocol Buffers](https://developers.google.com/protocol-buffers) along For linting and checking breaking changes, we use [buf](https://buf.build/). If you would like to run linting and check if the changes you have made are breaking then you will need to have docker running locally. Then the linting cmd will be `make proto-lint` and the breaking changes check will be `make proto-check-breaking`. -To generate new stubs based off of your changes you can run `make proto-gen` after installing `protoc` and gogoproto. +There are two ways to generate your proto stubs. + +1. Use Docker, pull an image that will generate your proto stubs with no need to install anything. `make proto-gen-docker` +2. Run `make proto-gen` after installing `protoc` and gogoproto. ### Installation Instructions diff --git a/Makefile b/Makefile index e313ce7a3..eb9626bf4 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,11 @@ proto-gen: @sh scripts/protocgen.sh .PHONY: proto-gen +proto-gen-docker: + @echo "Generating Protobuf files" + @docker run -v $(shell pwd):/workspace --workdir /workspace tendermintdev/docker-build-proto sh ./scripts/protocgen.sh +.PHONY: proto-gen-docker + proto-lint: @$(DOCKER_BUF) check lint --error-format=json .PHONY: proto-lint