forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Vendor tools into tools/* (cosmos#331)
* Add tools dir * Update Makefile to call tools/Makefile * Add cmd/basecoind to make make pass
- Loading branch information
Showing
11 changed files
with
312 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ vendor | |
merkleeyes.db | ||
build | ||
docs/guide/*.sh | ||
tools/bin/* | ||
examples/build/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,85 @@ | ||
GOTOOLS = github.com/mitchellh/gox \ | ||
github.com/Masterminds/glide \ | ||
github.com/rigelrozanski/shelldown/cmd/shelldown | ||
TUTORIALS=$(shell find docs/guide -name "*md" -type f) | ||
PACKAGES=$(shell go list ./... | grep -v '/vendor/' | grep -v '_attic') | ||
BUILD_FLAGS = -ldflags "-X github.com/cosmos/cosmos-sdk/version.GitCommit=`git rev-parse --short HEAD`" | ||
|
||
EXAMPLES := dummy basecoin | ||
all: check_tools get_vendor_deps build test install | ||
|
||
INSTALL_EXAMPLES := $(addprefix install_,${EXAMPLES}) | ||
TEST_EXAMPLES := $(addprefix testex_,${EXAMPLES}) | ||
######################################## | ||
### Build | ||
|
||
LINKER_FLAGS:="-X github.com/cosmos/cosmos-sdk/client/commands.CommitHash=`git rev-parse --short HEAD`" | ||
build: | ||
go build $(BUILD_FLAGS) -o build/basecoin ./examples/basecoin/cmd/... | ||
|
||
all: get_vendor_deps install test | ||
dist: | ||
@bash publish/dist.sh | ||
@bash publish/publish.sh | ||
|
||
$(INSTALL_EXAMPLES): install_%: | ||
cd ./examples/$* && go install | ||
|
||
$(TEST_EXAMPLES): testex_%: | ||
cd ./examples/$* && make test_cli | ||
######################################## | ||
### Tools & dependencies | ||
|
||
install: $(INSTALL_EXAMPLES) | ||
check_tools: | ||
cd tools && $(MAKE) check | ||
|
||
dist: | ||
@bash publish/dist.sh | ||
@bash publish/publish.sh | ||
get_tools: | ||
cd tools && $(MAKE) | ||
|
||
get_vendor_deps: | ||
@rm -rf vendor/ | ||
@echo "--> Running glide install" | ||
@glide install | ||
|
||
draw_deps: | ||
@# requires brew install graphviz or apt-get install graphviz | ||
go get github.com/RobotsAndPencils/goviz | ||
@goviz -i github.com/tendermint/tendermint/cmd/tendermint -d 3 | dot -Tpng -o dependency-graph.png | ||
|
||
benchmark: | ||
@go test -bench=. ./modules/... | ||
|
||
######################################## | ||
### Testing | ||
|
||
TUTORIALS=$(shell find docs/guide -name "*md" -type f) | ||
|
||
#test: test_unit test_cli test_tutorial | ||
test: test_unit # test_cli | ||
|
||
test_unit: | ||
@go test `glide novendor | grep -v _attic` | ||
|
||
test_cli: $(TEST_EXAMPLES) | ||
# sudo apt-get install jq | ||
# wget "https://raw.githubusercontent.com/kward/shunit2/master/source/2.1/src/shunit2" | ||
@go test $(PACKAGES) | ||
|
||
test_tutorial: | ||
@shelldown ${TUTORIALS} | ||
@for script in docs/guide/*.sh ; do \ | ||
bash $$script ; \ | ||
done | ||
|
||
get_vendor_deps: get_tools | ||
@glide install | ||
benchmark: | ||
@go test -bench=. $(PACKAGES) | ||
|
||
build-docker: | ||
@docker run -it --rm -v "$(PWD):/go/src/github.com/tendermint/basecoin" -w \ | ||
"/go/src/github.com/tendermint/basecoin" -e "CGO_ENABLED=0" golang:alpine go build ./cmd/basecoin | ||
@docker build -t "tendermint/basecoin" . | ||
|
||
get_tools: | ||
@go get $(GOTOOLS) | ||
######################################## | ||
### Devdoc | ||
|
||
DEVDOC_SAVE = docker commit `docker ps -a -n 1 -q` devdoc:local | ||
|
||
devdoc_init: | ||
docker run -it -v "$(CURDIR):/go/src/github.com/cosmos/cosmos-sdk" -w "/go/src/github.com/cosmos/cosmos-sdk" tendermint/devdoc echo | ||
# TODO make this safer | ||
$(call DEVDOC_SAVE) | ||
|
||
devdoc: | ||
docker run -it -v "$(CURDIR):/go/src/github.com/cosmos/cosmos-sdk" -w "/go/src/github.com/cosmos/cosmos-sdk" devdoc:local bash | ||
|
||
devdoc_save: | ||
# TODO make this safer | ||
$(call DEVDOC_SAVE) | ||
|
||
devdoc_clean: | ||
docker rmi -f $$(docker images -f "dangling=true" -q) | ||
|
||
clean: | ||
# maybe cleaning up cache and vendor is overkill, but sometimes | ||
# you don't get the most recent versions with lots of branches, changes, rebases... | ||
@rm -rf ~/.glide/cache/src/https-github.com-tendermint-* | ||
@rm -rf ./vendor | ||
@rm -f $GOPATH/bin/{basecoin,basecli,counter,countercli} | ||
devdoc_update: | ||
docker pull tendermint/devdoc | ||
|
||
# when your repo is getting a little stale... just make fresh | ||
fresh: clean get_vendor_deps install | ||
@if [ "$(git status -s)" ]; then echo; echo "Warning: uncommited changes"; git status -s; fi | ||
|
||
.PHONY: all build install test test_cli test_unit test_store get_vendor_deps build-docker clean fresh benchmark | ||
# To avoid unintended conflicts with file names, always add to .PHONY | ||
# unless there is a reason not to. | ||
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html | ||
.PHONY: build dist check_tools get_tools get_vendor_deps draw_deps test test_unit test_tutorial benchmark devdoc_init devdoc devdoc_save devdoc_update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
func main() { | ||
fmt.Println("TODO: move examples/basecoin/main.go here and refactor") | ||
} |
Empty file.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
all: install_glide check get_vendor_deps install | ||
|
||
|
||
######################################## | ||
### Glide | ||
|
||
GLIDE = github.com/tendermint/glide | ||
GLIDE_CHECK := $(shell command -v glide 2> /dev/null) | ||
|
||
check: | ||
ifndef GLIDE_CHECK | ||
@echo "No glide in path. Install with 'make install_glide'." | ||
else | ||
@echo "Found glide in path." | ||
endif | ||
|
||
install_glide: | ||
ifdef GLIDE_CHECK | ||
@echo "Glide is already installed. Run 'make update_glide' to update." | ||
else | ||
@echo "$(ansi_grn)Installing glide$(ansi_end)" | ||
go get -v $(GLIDE) | ||
endif | ||
|
||
update_glide: | ||
@echo "$(ansi_grn)Updating glide$(ansi_end)" | ||
go get -u -v $(GLIDE) | ||
|
||
|
||
######################################## | ||
### Install tools | ||
|
||
|
||
get_vendor_deps: check | ||
@rm -rf vendor/ | ||
@echo "--> Running glide install" | ||
@glide install | ||
|
||
install: get_vendor_deps | ||
@echo "$(ansi_grn)Installing tools$(ansi_end)" | ||
@echo "$(ansi_yel)Install go-vendorinstall$(ansi_end)" | ||
go build -o bin/go-vendorinstall go-vendorinstall/*.go | ||
|
||
@echo "$(ansi_yel)Install gometalinter.v2$(ansi_end)" | ||
GOBIN=$(CURDIR)/bin ./bin/go-vendorinstall gopkg.in/alecthomas/gometalinter.v2 | ||
|
||
@echo "$(ansi_yel)Install shelldown$(ansi_end)" | ||
GOBIN=$(CURDIR)/bin ./bin/go-vendorinstall github.com/rigelrozanski/shelldown/cmd/shelldown | ||
|
||
@echo "$(ansi_grn)Done installing tools$(ansi_end)" | ||
|
||
|
||
######################################## | ||
# ANSI colors | ||
|
||
ansi_red=\033[0;31m | ||
ansi_grn=\033[0;32m | ||
ansi_yel=\033[0;33m | ||
ansi_end=\033[0m | ||
|
||
|
||
# To avoid unintended conflicts with file names, always add to .PHONY | ||
# unless there is a reason not to. | ||
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html | ||
.PHONY: check install_glide update_glide get_vendor_deps install |
Empty file.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package: github.com/cosmos/cosmos-sdk/tools | ||
import: | ||
- package: github.com/rigelrozanski/shelldown | ||
subpackages: | ||
- cmd/shelldown | ||
- package: gopkg.in/alecthomas/gometalinter.v2 |
Oops, something went wrong.