Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R4R: Fix Makefile targets dependencies #2744

Merged
merged 5 commits into from
Nov 14, 2018
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ GOTOOLS = \
github.com/golang/dep/cmd/dep \
github.com/alecthomas/gometalinter \
github.com/rakyll/statik
GOBIN ?= $(GOPATH)/bin
alexanderbez marked this conversation as resolved.
Show resolved Hide resolved
all: get_tools get_vendor_deps install install_examples install_cosmos-sdk-cli test_lint test

########################################
Expand Down Expand Up @@ -113,26 +114,29 @@ 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

get_dev_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)
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
Expand Down Expand Up @@ -203,7 +207,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
Expand Down Expand Up @@ -261,7 +265,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 \
Expand Down