makefile: buf setup backport v0.34 (#8863)

This commit is contained in:
Jasmina Malicevic
2022-06-24 19:58:25 +02:00
committed by GitHub
parent 4a1df4911d
commit b83cc0aeda
19 changed files with 318 additions and 94 deletions

View File

@@ -13,7 +13,6 @@ endif
LD_FLAGS = -X github.com/tendermint/tendermint/version.TMCoreSemVer=$(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
CGO_ENABLED ?= 0
# handle nostrip
@@ -70,6 +69,15 @@ install:
CGO_ENABLED=$(CGO_ENABLED) go install $(BUILD_FLAGS) -tags $(BUILD_TAGS) ./cmd/tendermint
.PHONY: install
###############################################################################
### Mocks ###
###############################################################################
mockery:
go generate -run="./scripts/mockery_generate.sh" ./...
.PHONY: mockery
###############################################################################
### Protobuf ###
###############################################################################
@@ -80,7 +88,13 @@ ifeq (,$(shell which protoc-gen-gogofaster))
endif
.PHONY: check-proto-deps
proto-gen:
check-proto-format-deps:
ifeq (,$(shell which clang-format))
$(error "clang-format is required for Protobuf formatting. See instructions for your platform on how to install it.")
endif
.PHONY: check-proto-format-deps
proto-gen: check-proto-deps
@echo "Generating Protobuf files"
@go run github.com/bufbuild/buf/cmd/buf generate
@mv ./proto/tendermint/abci/types.pb.go ./abci/types/
@@ -93,9 +107,9 @@ proto-lint: check-proto-deps
@go run github.com/bufbuild/buf/cmd/buf lint
.PHONY: proto-lint
proto-format:
proto-format: check-proto-format-deps
@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 {} \;
@find . -name '*.proto' -path "./proto/*" -exec clang-format -i {} \;
.PHONY: proto-format
proto-check-breaking: check-proto-deps
@@ -107,7 +121,7 @@ proto-check-breaking: check-proto-deps
.PHONY: proto-check-breaking
proto-check-breaking-ci:
@$(DOCKER_BUF) check breaking --against-input $(HTTPS_GIT)#branch=master
@go run github.com/bufbuild/buf/cmd/buf breaking --against ".git"#branch=v0.34.x
.PHONY: proto-check-breaking-ci
###############################################################################