Fix Makefile's all target (#3085)

- Rename get_dev_tools to devtools
- tools and devtools now create a stamp after execution so
  that they are not executed twice on the same pipeline
- Add clean target to remove stamps
This commit is contained in:
Alessio Treglia 2018-12-20 18:03:59 +00:00 committed by Jack Zampolin
parent 5a13e75367
commit 0c0bff7ea0
11 changed files with 41 additions and 25 deletions

View File

@ -57,7 +57,7 @@ jobs:
name: tools name: tools
command: | command: |
export PATH="$GOBIN:$PATH" export PATH="$GOBIN:$PATH"
make get_tools make tools
- run: - run:
name: dependencies name: dependencies
command: | command: |
@ -91,8 +91,7 @@ jobs:
name: Get metalinter name: Get metalinter
command: | command: |
export PATH="$GOBIN:$PATH" export PATH="$GOBIN:$PATH"
make get_tools make devtools
make get_dev_tools
- run: - run:
name: Lint source name: Lint source
command: | command: |
@ -286,7 +285,7 @@ jobs:
sudo mv go /usr/local sudo mv go /usr/local
popd popd
set -x set -x
make get_tools make tools
make get_vendor_deps make get_vendor_deps
make build-linux make build-linux
make localnet-start make localnet-start

View File

@ -15,7 +15,7 @@ COPY . .
# Install minimum necessary dependencies, build Cosmos SDK, remove packages # Install minimum necessary dependencies, build Cosmos SDK, remove packages
RUN apk add --no-cache $PACKAGES && \ RUN apk add --no-cache $PACKAGES && \
make get_tools && \ make tools && \
make get_vendor_deps && \ make get_vendor_deps && \
make build && \ make build && \
make install make install

View File

@ -9,15 +9,15 @@ GOTOOLS = \
github.com/alecthomas/gometalinter \ github.com/alecthomas/gometalinter \
github.com/rakyll/statik github.com/rakyll/statik
GOBIN ?= $(GOPATH)/bin GOBIN ?= $(GOPATH)/bin
all: get_tools get_vendor_deps install install_examples install_cosmos-sdk-cli test_lint test all: devtools get_vendor_deps install install_examples install_cosmos-sdk-cli test_lint test
# The below include contains the get_tools target. # The below include contains the tools target.
include scripts/Makefile include scripts/Makefile
######################################## ########################################
### CI ### CI
ci: get_tools get_vendor_deps install test_cover test_lint test ci: devtools get_vendor_deps install test_cover test_lint test
######################################## ########################################
### Build/Install ### Build/Install
@ -117,33 +117,37 @@ check_tools:
update_tools: update_tools:
@echo "--> Updating tools to correct version" @echo "--> Updating tools to correct version"
$(MAKE) --always-make get_tools $(MAKE) --always-make tools
update_dev_tools: update_dev_tools:
@echo "--> Downloading linters (this may take awhile)" @echo "--> Downloading linters (this may take awhile)"
$(GOPATH)/src/github.com/alecthomas/gometalinter/scripts/install.sh -b $(GOBIN) $(GOPATH)/src/github.com/alecthomas/gometalinter/scripts/install.sh -b $(GOBIN)
go get -u github.com/tendermint/lint/golint go get -u github.com/tendermint/lint/golint
get_dev_tools: get_tools devtools: devtools-stamp
devtools-stamp: tools
@echo "--> Downloading linters (this may take awhile)" @echo "--> Downloading linters (this may take awhile)"
$(GOPATH)/src/github.com/alecthomas/gometalinter/scripts/install.sh -b $(GOBIN) $(GOPATH)/src/github.com/alecthomas/gometalinter/scripts/install.sh -b $(GOBIN)
go get github.com/tendermint/lint/golint go get github.com/tendermint/lint/golint
touch $@
get_vendor_deps: get_tools get_vendor_deps: tools
@echo "--> Generating vendor directory via dep ensure" @echo "--> Generating vendor directory via dep ensure"
@rm -rf .vendor-new @rm -rf .vendor-new
@dep ensure -v -vendor-only @dep ensure -v -vendor-only
update_vendor_deps: get_tools update_vendor_deps: tools
@echo "--> Running dep ensure" @echo "--> Running dep ensure"
@rm -rf .vendor-new @rm -rf .vendor-new
@dep ensure -v @dep ensure -v
draw_deps: get_tools draw_deps: tools
@# requires brew install graphviz or apt-get install graphviz @# requires brew install graphviz or apt-get install graphviz
go get github.com/RobotsAndPencils/goviz 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 @goviz -i github.com/cosmos/cosmos-sdk/cmd/gaia/cmd/gaiad -d 2 | dot -Tpng -o dependency-graph.png
clean:
rm -f devtools-stamp
######################################## ########################################
### Documentation ### Documentation
@ -264,7 +268,7 @@ localnet-stop:
# unless there is a reason not to. # unless there is a reason not to.
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html # 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 \ .PHONY: build build_cosmos-sdk-cli build_examples install install_examples install_cosmos-sdk-cli install_debug dist \
check_tools check_dev_tools get_dev_tools get_vendor_deps draw_deps test test_cli test_unit \ check_tools check_dev_tools get_vendor_deps draw_deps test test_cli test_unit \
test_cover test_lint benchmark devdoc_init devdoc devdoc_save devdoc_update \ test_cover test_lint benchmark devdoc_init devdoc devdoc_save devdoc_update \
build-linux build-docker-gaiadnode localnet-start localnet-stop \ build-linux build-docker-gaiadnode localnet-start localnet-stop \
format check-ledger test_sim_gaia_nondeterminism test_sim_modules test_sim_gaia_fast \ format check-ledger test_sim_gaia_nondeterminism test_sim_modules test_sim_gaia_fast \

2
Vagrantfile vendored
View File

@ -46,6 +46,6 @@ Vagrant.configure("2") do |config|
chown vagrant:vagrant /home/vagrant/.bash_profile chown vagrant:vagrant /home/vagrant/.bash_profile
su - vagrant -c 'source /home/vagrant/.bash_profile' su - vagrant -c 'source /home/vagrant/.bash_profile'
su - vagrant -c 'cd /home/vagrant/go/src/github.com/cosmos/cosmos-sdk && make get_tools' su - vagrant -c 'cd /home/vagrant/go/src/github.com/cosmos/cosmos-sdk && make tools'
SHELL SHELL
end end

View File

@ -110,3 +110,17 @@ We are using [Algolia](https://www.algolia.com) to power full-text search. This
Because the build processes are identical (as is the information contained herein), this file should be kept in sync as Because the build processes are identical (as is the information contained herein), this file should be kept in sync as
much as possible with its [counterpart in the Tendermint Core repo](https://github.com/tendermint/tendermint/blob/develop/docs/DOCS_README.md). much as possible with its [counterpart in the Tendermint Core repo](https://github.com/tendermint/tendermint/blob/develop/docs/DOCS_README.md).
### Update and Build the RPC docs
1. Execute the following command at the root directory to install the swagger-ui generate tool.
```
make tools
```
2. Edit API docs
1. Directly Edit API docs manually: `client/lcd/swagger-ui/swagger.yaml`.
2. Edit API docs within [SwaggerHub](https://app.swaggerhub.com). Please refer to this [document](https://app.swaggerhub.com/help/index) for how to use the about website to edit API docs.
3. Download `swagger.yaml` and replace the old `swagger.yaml` under fold `client/lcd/swagger-ui`.
4. Compile gaiacli
```
make install
```

View File

@ -23,7 +23,7 @@ cd $GOPATH/src/github.com/cosmos/cosmos-sdk
And run : And run :
``` ```
make get_tools // run make update_tools if you already had it installed make tools // run make update_tools if you already had it installed
make get_vendor_deps make get_vendor_deps
make install_examples make install_examples
``` ```

View File

@ -28,7 +28,7 @@ mkdir -p $GOPATH/src/github.com/cosmos
cd $GOPATH/src/github.com/cosmos cd $GOPATH/src/github.com/cosmos
git clone https://github.com/cosmos/cosmos-sdk git clone https://github.com/cosmos/cosmos-sdk
cd cosmos-sdk && git checkout master cd cosmos-sdk && git checkout master
make get_tools && make get_vendor_deps && make install make tools && make get_vendor_deps && make install
``` ```
> *NOTE*: If you have issues at this step, please check that you have the latest stable version of GO installed. > *NOTE*: If you have issues at this step, please check that you have the latest stable version of GO installed.

View File

@ -34,10 +34,10 @@ cd $(GITHUBDIR)$(FS)$(1)$(FS)$(2) && git fetch origin && git checkout -q $(3)
go_install = $(call go_get,$(1),$(2),$(3)) && cd $(GITHUBDIR)$(FS)$(1)$(FS)$(2) && $(GO) install go_install = $(call go_get,$(1),$(2),$(3)) && cd $(GITHUBDIR)$(FS)$(1)$(FS)$(2) && $(GO) install
### ###
# get_tools # tools
### ###
all: get_tools all: tools
get_tools: $(GOPATH)/bin/dep $(GOPATH)/bin/gometalinter $(GOPATH)/bin/statik $(GOPATH)/bin/goimports tools: $(GOPATH)/bin/dep $(GOPATH)/bin/gometalinter $(GOPATH)/bin/statik $(GOPATH)/bin/goimports
$(GOPATH)/bin/dep: $(GOPATH)/bin/dep:
$(call go_get,golang,dep,22125cfaa6ddc71e145b1535d4b7ee9744fefff2) $(call go_get,golang,dep,22125cfaa6ddc71e145b1535d4b7ee9744fefff2)
@ -53,5 +53,4 @@ $(GOPATH)/bin/statik:
$(GOPATH)/bin/goimports: $(GOPATH)/bin/goimports:
go get golang.org/x/tools/cmd/goimports go get golang.org/x/tools/cmd/goimports
.PHONY: all get_tools .PHONY: all

View File

@ -31,7 +31,7 @@ cd $GOPATH/src/$REPO
# build & install master # build & install master
git checkout $BRANCH git checkout $BRANCH
LEDGER_ENABLED=false make get_tools LEDGER_ENABLED=false make tools
LEDGER_ENABLED=false make get_vendor_deps LEDGER_ENABLED=false make get_vendor_deps
LEDGER_ENABLED=false make install LEDGER_ENABLED=false make install

View File

@ -47,7 +47,7 @@ cd $GOPATH/src/$REPO
# build & install master # build & install master
git checkout $BRANCH git checkout $BRANCH
gmake get_tools gmake tools
gmake get_vendor_deps gmake get_vendor_deps
gmake install gmake install
gmake install_examples gmake install_examples

View File

@ -34,7 +34,7 @@ cd $GOPATH/src/$REPO
# build & install master # build & install master
git checkout $BRANCH git checkout $BRANCH
LEDGER_ENABLED=false make get_tools LEDGER_ENABLED=false make tools
LEDGER_ENABLED=false make get_vendor_deps LEDGER_ENABLED=false make get_vendor_deps
LEDGER_ENABLED=false make install LEDGER_ENABLED=false make install