proto: update the mechanism for generating protos from spec repo (#7269)

This pull request updates the `protocgen.sh` script to insert the `go_package` option to all of the downloaded proto files. A related pull request into the spec repo removes this options from the .proto files: https://github.com/tendermint/spec/pull/358

This pull requests, along with the related spec PR, aim to move the creation of the `tendermintdev/docker-build-proto` container into the spec repo. This change also relies on several fixes to that container that are made in the PR into the spec repo.
This commit is contained in:
William Banfield
2021-11-15 20:06:15 +00:00
committed by GitHub
parent 2a455be46c
commit d5df412b26
7 changed files with 59 additions and 138 deletions
+6 -6
View File
@@ -15,7 +15,7 @@ endif
LD_FLAGS = -X github.com/tendermint/tendermint/version.TMVersion=$(VERSION)
BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)"
HTTPS_GIT := https://github.com/tendermint/tendermint.git
DOCKER_BUF := docker run -v $(shell pwd):/workspace --workdir /workspace bufbuild/buf
DOCKER_PROTO_BUILDER := docker run -v $(shell pwd):/workspace --workdir /workspace tendermintdev/docker-build-proto
CGO_ENABLED ?= 0
# handle nostrip
@@ -85,24 +85,24 @@ proto-all: proto-gen proto-lint proto-check-breaking
proto-gen:
@docker pull -q tendermintdev/docker-build-proto
@echo "Generating Protobuf files"
@docker run -v $(shell pwd):/workspace --workdir /workspace tendermintdev/docker-build-proto sh ./scripts/protocgen.sh
@$(DOCKER_PROTO_BUILDER) sh ./scripts/protocgen.sh
.PHONY: proto-gen
proto-lint:
@$(DOCKER_BUF) lint --error-format=json
@$(DOCKER_PROTO_BUILDER) buf lint --error-format=json
.PHONY: proto-lint
proto-format:
@echo "Formatting Protobuf files"
docker run -v $(shell pwd):/workspace --workdir /workspace tendermintdev/docker-build-proto find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;
@$(DOCKER_PROTO_BUILDER) find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;
.PHONY: proto-format
proto-check-breaking:
@$(DOCKER_BUF) breaking --against .git#branch=master
@$(DOCKER_PROTO_BUILDER) buf breaking --against .git#branch=master
.PHONY: proto-check-breaking
proto-check-breaking-ci:
@$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=master
@$(DOCKER_PROTO_BUILDER) buf breaking --against $(HTTPS_GIT)#branch=master
.PHONY: proto-check-breaking-ci
###############################################################################