Merge PR #3343: Enrich version command's output

This commit is contained in:
Alessio Treglia 2019-01-22 21:16:29 +01:00 committed by Christopher Goes
parent fae7852b61
commit bf59291a79
5 changed files with 30 additions and 18 deletions

View File

@ -44,7 +44,7 @@ deps: &dependencies
name: dependencies
command: |
export PATH="$GOBIN:$PATH"
make get_vendor_deps
make vendor-deps
jobs:
setup_dependencies:
@ -260,7 +260,7 @@ jobs:
popd
set -x
make tools
make get_vendor_deps
make vendor-deps
make build-linux
make localnet-start
./scripts/localnet-blocks-test.sh 40 5 10 localhost
@ -292,7 +292,7 @@ jobs:
command: |
source $BASH_ENV
make tools
make get_vendor_deps
make vendor-deps
make install
- run:
name: Integration tests

View File

@ -1,15 +1,20 @@
PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation')
PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation')
VERSION := $(subst v,,$(shell git describe --tags --long))
COMMIT := $(shell git log -1 --format='%H')
BUILD_TAGS = netgo
BUILD_FLAGS = -tags "${BUILD_TAGS}" -ldflags "-X github.com/cosmos/cosmos-sdk/version.Version=${VERSION}"
CAT := $(if $(filter $(OS),Windows_NT),type,cat)
BUILD_FLAGS = -tags "${BUILD_TAGS}" -ldflags \
"-X github.com/cosmos/cosmos-sdk/version.Version=${VERSION} \
-X github.com/cosmos/cosmos-sdk/version.Commit=${COMMIT} \
-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 +22,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 +136,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 +153,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 +274,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 \

View File

@ -19,6 +19,7 @@ BREAKING CHANGES
* [\#3069](https://github.com/cosmos/cosmos-sdk/pull/3069) `--fee` flag renamed to `--fees` to support multiple coins
* [\#3156](https://github.com/cosmos/cosmos-sdk/pull/3156) Remove unimplemented `gaiacli init` command
* [\#2222] `gaiacli tx stake` -> `gaiacli tx staking`, `gaiacli query stake` -> `gaiacli query staking`
* [\#1894](https://github.com/cosmos/cosmos-sdk/issues/1894) `version` command now shows latest commit, vendor dir hash, and build machine info.
* [\#3320](https://github.com/cosmos/cosmos-sdk/pull/3320) Ensure all `gaiacli query` commands respect the `--output` and `--indent` flags
* Gaia
@ -26,6 +27,7 @@ BREAKING CHANGES
* [\#3162](https://github.com/cosmos/cosmos-sdk/issues/3162) The `--gas` flag now takes `auto` instead of `simulate`
in order to trigger a simulation of the tx before the actual execution.
* [\#3285](https://github.com/cosmos/cosmos-sdk/pull/3285) New `gaiad tendermint version` to print libs versions
* [\#1894](https://github.com/cosmos/cosmos-sdk/pull/1894) `version` command now shows latest commit, vendor dir hash, and build machine info.
* SDK
* [staking] \#2513 Validator power type from Dec -> Int
@ -35,10 +37,9 @@ BREAKING CHANGES
* [\#3242](https://github.com/cosmos/cosmos-sdk/issues/3242) Fix infinite gas
meter utilization during aborted ante handler executions.
* [x/distribution] \#3292 Enable or disable withdraw addresses with a parameter in the param store
* [\#2222] [x/staking] `/stake` -> `/staking` module rename
* [staking] \#2222 `/stake` -> `/staking` module rename
* [staking] \#1268 `LooseTokens` -> `NotBondedTokens`
* [staking] \#1402 Redelegation and unbonding-delegation structs changed to include multiple an array of entries
* [staking] \#3289 misc renames:
* `Validator.UnbondingMinTime` -> `Validator.UnbondingCompletionTime`
* `Delegation` -> `Value` in `MsgCreateValidator` and `MsgDelegate`
@ -117,12 +118,8 @@ IMPROVEMENTS
slashing, and staking modules.
* [\#3093](https://github.com/cosmos/cosmos-sdk/issues/3093) Ante handler does no longer read all accounts in one go when processing signatures as signature
verification may fail before last signature is checked.
<<<<<<< HEAD
* [staking] \#1402 Add for multiple simultaneous redelegations or unbonding-delegations within an unbonding period
* [staking] \#1268 staking spec rewrite
=======
* [x/stake] \#1402 Add for multiple simultaneous redelegations or unbonding-delegations within an unbonding period
>>>>>>> Pending.md
* Tendermint

View File

@ -2,6 +2,7 @@ package version
import (
"fmt"
"runtime"
"github.com/spf13/cobra"
)
@ -22,5 +23,9 @@ func GetVersion() string {
// CMD
func printVersion(cmd *cobra.Command, args []string) {
fmt.Println(GetVersion())
fmt.Println("cosmos-sdk:", GetVersion())
fmt.Println("git commit:", Commit)
fmt.Println("vendor hash:", VendorDirHash)
fmt.Printf("go version %s %s/%s\n",
runtime.Version(), runtime.GOOS, runtime.GOARCH)
}

View File

@ -1,5 +1,9 @@
//nolint
package version
// GitCommit set by build flags
var Version = ""
// Variables set by build flags
var (
Commit = ""
Version = ""
VendorDirHash = ""
)