From 80e53a4d89f8646f0aa3cfaa365247188f5facfb Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Fri, 3 Jul 2020 20:50:14 +0200 Subject: [PATCH] buildsystem: various small improvements (#6598) Follow-up of #6101. - Makefile: Set all as actual default target. - contrib/devtools/Makefile: The buf target was running unconditionally. Install protoc-gen-gocosmos along with protoc. --- .gitignore | 1 + Makefile | 6 +++--- contrib/devtools/Makefile | 24 +++++++++++++----------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index f3a46c9687dc..9894b7b68fea 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ docs/node_modules dist tools-stamp proto-tools-stamp +buf-stamp # Data - ideally these don't exist baseapp/data/* diff --git a/Makefile b/Makefile index b52ce1cf4a81..ddd74b5b7608 100644 --- a/Makefile +++ b/Makefile @@ -14,17 +14,17 @@ DOCKER_BUF := docker run -v $(shell pwd):/workspace --workdir /workspace bufbuil export GO111MODULE = on +all: tools build lint test + # The below include contains the tools and runsim targets. include contrib/devtools/Makefile -all: tools build lint test - ############################################################################### ### Build ### ############################################################################### build: go.sum - @go build -mod=readonly ./... + go build -mod=readonly ./... build-sim: go.sum mkdir -p $(BUILDDIR) diff --git a/contrib/devtools/Makefile b/contrib/devtools/Makefile index c6cdb2662cf1..6fd280fb4e6d 100644 --- a/contrib/devtools/Makefile +++ b/contrib/devtools/Makefile @@ -60,7 +60,7 @@ tools-stamp: proto-tools statik runsim # Install the runsim binary with a temporary workaround of entering an outside # directory as the "go get" command ignores the -mod option and will polute the # go.{mod, sum} files. -# +# # ref: https://github.com/golang/go/issues/30515 statik: $(STATIK) $(STATIK): @@ -70,7 +70,7 @@ $(STATIK): # Install the runsim binary with a temporary workaround of entering an outside # directory as the "go get" command ignores the -mod option and will polute the # go.{mod, sum} files. -# +# # ref: https://github.com/golang/go/issues/30515 runsim: $(RUNSIM) $(RUNSIM): @@ -85,7 +85,7 @@ ifeq ($(UNAME_S),Darwin) PROTOC_ZIP ?= protoc-3.11.2-osx-x86_64.zip endif -proto-tools: proto-tools-stamp protoc-gen-gocosmos buf +proto-tools: proto-tools-stamp buf proto-tools-stamp: @echo "Installing protoc compiler..." @@ -95,7 +95,14 @@ proto-tools-stamp: unzip -o ${PROTOC_ZIP} -d $(PREFIX) 'include/*'; \ rm -f ${PROTOC_ZIP}) -buf: + @echo "Installing protoc-gen-gocosmos..." + @go install github.com/regen-network/cosmos-proto/protoc-gen-gocosmos + + touch $@ + +buf: buf-stamp + +buf-stamp: @echo "Installing buf..." @curl -sSL \ "https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-${UNAME_S}-${UNAME_M}" \ @@ -104,13 +111,8 @@ buf: touch $@ -protoc-gen-gocosmos: - @echo "Installing protoc-gen-gocosmos..." - @go install github.com/regen-network/cosmos-proto/protoc-gen-gocosmos - tools-clean: rm -f $(STATIK) $(GOLANGCI_LINT) $(RUNSIM) - rm -f tools-stamp proto-tools-stamp + rm -f tools-stamp proto-tools-stamp buf-stamp -.PHONY: tools-clean statik runsim \ - protoc-gen-gocosmos +.PHONY: tools-clean statik runsim