From 983832f94e2aaed7235a3d4c440914d786d0427a Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Tue, 7 Jun 2022 21:30:23 +0200 Subject: [PATCH] update Makefile with buf fixes (#213) (#1490) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update Makefile with buf fixes * update makefile with changes from SDK Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> --- Makefile | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index b4aaf351dd0..82c75b862ef 100644 --- a/Makefile +++ b/Makefile @@ -365,26 +365,34 @@ devdoc-update: ### Protobuf ### ############################################################################### +containerProtoVer=v0.2 +containerProtoImage=tendermintdev/sdk-proto-gen:$(containerProtoVer) +containerProtoGen=cosmos-sdk-proto-gen-$(containerProtoVer) +containerProtoGenSwagger=cosmos-sdk-proto-gen-swagger-$(containerProtoVer) +containerProtoFmt=cosmos-sdk-proto-fmt-$(containerProtoVer) + proto-all: proto-format proto-lint proto-gen proto-gen: @echo "Generating Protobuf files" - $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protocgen.sh + @if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then docker start -a $(containerProtoGen); else docker run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \ + sh ./scripts/protocgen.sh; fi proto-format: @echo "Formatting Protobuf files" - $(DOCKER) run --rm -v $(CURDIR):/workspace \ - --workdir /workspace tendermintdev/docker-build-proto \ - find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \; + @if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoFmt}$$"; then docker start -a $(containerProtoFmt); else docker run --name $(containerProtoFmt) -v $(CURDIR):/workspace --workdir /workspace tendermintdev/docker-build-proto \ + find ./ -not -path "./third_party/*" -name "*.proto" -exec clang-format -i {} \; ; fi proto-swagger-gen: - @./scripts/protoc-swagger-gen.sh + @echo "Generating Protobuf Swagger" + @if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGenSwagger}$$"; then docker start -a $(containerProtoGenSwagger); else docker run --name $(containerProtoGenSwagger) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \ + sh ./scripts/protoc-swagger-gen.sh; fi proto-lint: - @$(DOCKER_BUF) check lint --error-format=json + @$(DOCKER_BUF) lint --error-format=json proto-check-breaking: - @$(DOCKER_BUF) check breaking --against-input $(HTTPS_GIT)#branch=main + @$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=main TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/v0.34.0-rc6/proto/tendermint GOGO_PROTO_URL = https://raw.githubusercontent.com/regen-network/protobuf/cosmos