diff --git a/Makefile b/Makefile index dbc31842c49e..81894ea97d72 100644 --- a/Makefile +++ b/Makefile @@ -2,14 +2,14 @@ PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation') PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation') VERSION := $(subst v,,$(shell git describe --tags --long)) BUILD_TAGS = netgo -BUILD_FLAGS = -tags "${BUILD_TAGS}" -ldflags "-X github.com/cosmos/cosmos-sdk/version.Version=${VERSION}" +BUILD_FLAGS = -tags "${BUILD_TAGS}" -ldflags "-X github.com/cosmos/cosmos-sdk/version.Version=${VERSION} -X github.com/cosmos/cosmos-sdk/version.VendorDirHash=$(shell cat vendor-deps)" LEDGER_ENABLED ?= true GOTOOLS = \ github.com/golang/dep/cmd/dep \ github.com/alecthomas/gometalinter \ github.com/rakyll/statik GOBIN ?= $(GOPATH)/bin -all: devtools get_vendor_deps install install_examples install_cosmos-sdk-cli test_lint test +all: devtools vendor-deps install install_examples install_cosmos-sdk-cli test_lint test # The below include contains the tools target. include scripts/Makefile @@ -17,7 +17,7 @@ include scripts/Makefile ######################################## ### CI -ci: devtools get_vendor_deps install test_cover test_lint test +ci: devtools vendor-deps install test_cover test_lint test ######################################## ### Build/Install @@ -131,10 +131,11 @@ devtools-stamp: tools go get github.com/tendermint/lint/golint touch $@ -get_vendor_deps: tools +vendor-deps: tools @echo "--> Generating vendor directory via dep ensure" @rm -rf .vendor-new @dep ensure -v -vendor-only + tar -c vendor/ | sha1sum | cut -d' ' -f1 > $@ update_vendor_deps: tools @echo "--> Running dep ensure" @@ -147,7 +148,7 @@ draw_deps: tools @goviz -i github.com/cosmos/cosmos-sdk/cmd/gaia/cmd/gaiad -d 2 | dot -Tpng -o dependency-graph.png clean: - rm -f devtools-stamp + rm -f devtools-stamp vendor-deps ######################################## ### Documentation @@ -268,7 +269,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_vendor_deps draw_deps test test_cli test_unit \ +check_tools check_dev_tools 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 \ diff --git a/version/command.go b/version/command.go index 8f47dba8f5fc..d5643e7b03b9 100644 --- a/version/command.go +++ b/version/command.go @@ -2,6 +2,7 @@ package version import ( "fmt" + "runtime" "github.com/spf13/cobra" ) @@ -22,5 +23,7 @@ func GetVersion() string { // CMD func printVersion(cmd *cobra.Command, args []string) { - fmt.Println(GetVersion()) + fmt.Println("cosmos-sdk", GetVersion()) + fmt.Println("Built with Go", runtime.Version()) + fmt.Println("vendor/ directory's hash:", VendorDirHash) } diff --git a/version/version.go b/version/version.go index 407797eeb017..3cb758ffd54f 100644 --- a/version/version.go +++ b/version/version.go @@ -3,3 +3,6 @@ package version // GitCommit set by build flags var Version = "" + +// VendorDirHash is set by build flags +var VendorDirHash = ""