From cf81cdd3877b1a1c3e8915e82b005db325b5fe6d Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Fri, 9 Nov 2018 10:48:11 +0000 Subject: [PATCH 1/5] Fix Makefile targets dependencies --- Makefile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 3d76c78f7d6d..8084dd9e9b18 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ GOTOOLS = \ github.com/golang/dep/cmd/dep \ github.com/alecthomas/gometalinter \ github.com/rakyll/statik +GOBIN ?= $(GOPATH)/bin all: get_tools get_vendor_deps install install_examples install_cosmos-sdk-cli test_lint test ######################################## @@ -76,11 +77,11 @@ else go build $(BUILD_FLAGS) -o build/democli ./examples/democoin/cmd/democli endif -install: check-ledger update_gaia_lite_docs +install: build check-ledger update_gaia_lite_docs go install $(BUILD_FLAGS) ./cmd/gaia/cmd/gaiad go install $(BUILD_FLAGS) ./cmd/gaia/cmd/gaiacli -install_examples: +install_examples: build_examples go install $(BUILD_FLAGS) ./examples/basecoin/cmd/basecoind go install $(BUILD_FLAGS) ./examples/basecoin/cmd/basecli go install $(BUILD_FLAGS) ./examples/democoin/cmd/democoind @@ -117,22 +118,22 @@ get_tools: @echo "--> Installing tools" $(MAKE) -C scripts get_tools -get_dev_tools: +get_dev_tools: get_tools @echo "--> Downloading linters (this may take awhile)" $(GOPATH)/src/github.com/alecthomas/gometalinter/scripts/install.sh -b $(GOBIN) go get github.com/tendermint/lint/golint -get_vendor_deps: +get_vendor_deps: get_tools @echo "--> Generating vendor directory via dep ensure" @rm -rf .vendor-new @dep ensure -v -vendor-only -update_vendor_deps: +update_vendor_deps: get_tools @echo "--> Running dep ensure" @rm -rf .vendor-new @dep ensure -v -draw_deps: +draw_deps: get_tools @# requires brew install graphviz or apt-get install graphviz go get github.com/RobotsAndPencils/goviz @goviz -i github.com/cosmos/cosmos-sdk/cmd/gaia/cmd/gaiad -d 2 | dot -Tpng -o dependency-graph.png @@ -203,7 +204,7 @@ test_sim_gaia_profile: test_cover: @export VERSION=$(VERSION); bash tests/test_cover.sh -test_lint: +test_lint: get_dev_tools gometalinter --config=tools/gometalinter.json ./... !(gometalinter --exclude /usr/lib/go/src/ --exclude client/lcd/statik/statik.go --exclude 'vendor/*' --disable-all --enable='errcheck' --vendor ./... | grep -v "client/") find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s From 7e36140c5e80669410d105fc3e44106317f47c4e Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Fri, 9 Nov 2018 14:34:06 +0000 Subject: [PATCH 2/5] Remove unnecessary build deps from install targets --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8084dd9e9b18..7fd056a1fb5b 100644 --- a/Makefile +++ b/Makefile @@ -77,11 +77,11 @@ else go build $(BUILD_FLAGS) -o build/democli ./examples/democoin/cmd/democli endif -install: build check-ledger update_gaia_lite_docs +install: check-ledger update_gaia_lite_docs go install $(BUILD_FLAGS) ./cmd/gaia/cmd/gaiad go install $(BUILD_FLAGS) ./cmd/gaia/cmd/gaiacli -install_examples: build_examples +install_examples: go install $(BUILD_FLAGS) ./examples/basecoin/cmd/basecoind go install $(BUILD_FLAGS) ./examples/basecoin/cmd/basecli go install $(BUILD_FLAGS) ./examples/democoin/cmd/democoind From ebbe6106ebc3d16544fa9cc0cf817c226df671b6 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Tue, 13 Nov 2018 14:44:06 +0000 Subject: [PATCH 3/5] Apply greg's suggestion --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7fd056a1fb5b..e58859b374cb 100644 --- a/Makefile +++ b/Makefile @@ -114,7 +114,7 @@ update_dev_tools: $(GOPATH)/src/github.com/alecthomas/gometalinter/scripts/install.sh -b $(GOBIN) go get -u github.com/tendermint/lint/golint -get_tools: +get_tools: $(GOBIN)/dep $(GOBIN)/gometalinter $(GOBIN)/statik @echo "--> Installing tools" $(MAKE) -C scripts get_tools @@ -262,7 +262,7 @@ localnet-stop: # unless there is a reason not to. # https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html .PHONY: build build_cosmos-sdk-cli build_examples install install_examples install_cosmos-sdk-cli install_debug dist \ -check_tools check_dev_tools get_tools get_dev_tools get_vendor_deps draw_deps test test_cli test_unit \ +check_tools check_dev_tools get_dev_tools get_vendor_deps draw_deps test test_cli test_unit \ test_cover test_lint benchmark devdoc_init devdoc devdoc_save devdoc_update \ build-linux build-docker-gaiadnode localnet-start localnet-stop \ format check-ledger test_sim_gaia_nondeterminism test_sim_modules test_sim_gaia_fast \ From ca4addf19132bf62328c61862d63e3c8fe4f0692 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Tue, 13 Nov 2018 15:04:04 +0000 Subject: [PATCH 4/5] Create a rule for each tool --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index e58859b374cb..da3b3e542009 100644 --- a/Makefile +++ b/Makefile @@ -118,6 +118,9 @@ get_tools: $(GOBIN)/dep $(GOBIN)/gometalinter $(GOBIN)/statik @echo "--> Installing tools" $(MAKE) -C scripts get_tools +$(GOBIN)/%: + $(MAKE) -C scripts $(subst $(GOBIN)/,,$(@)) + get_dev_tools: get_tools @echo "--> Downloading linters (this may take awhile)" $(GOPATH)/src/github.com/alecthomas/gometalinter/scripts/install.sh -b $(GOBIN) From 444925b05a997a844c4b5a2f721de75bdae721c7 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Wed, 14 Nov 2018 12:00:42 +0000 Subject: [PATCH 5/5] Don't dep test_lint on tools --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index da3b3e542009..6fb4407a82f4 100644 --- a/Makefile +++ b/Makefile @@ -207,7 +207,7 @@ test_sim_gaia_profile: test_cover: @export VERSION=$(VERSION); bash tests/test_cover.sh -test_lint: get_dev_tools +test_lint: gometalinter --config=tools/gometalinter.json ./... !(gometalinter --exclude /usr/lib/go/src/ --exclude client/lcd/statik/statik.go --exclude 'vendor/*' --disable-all --enable='errcheck' --vendor ./... | grep -v "client/") find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s