Skip to content

Commit

Permalink
Fix Makefile's all target (cosmos#3085)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
alessio authored and jackzampolin committed Dec 20, 2018
1 parent 5a13e75 commit 0c0bff7
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 25 deletions.
7 changes: 3 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
name: tools
command: |
export PATH="$GOBIN:$PATH"
make get_tools
make tools
- run:
name: dependencies
command: |
Expand Down Expand Up @@ -91,8 +91,7 @@ jobs:
name: Get metalinter
command: |
export PATH="$GOBIN:$PATH"
make get_tools
make get_dev_tools
make devtools
- run:
name: Lint source
command: |
Expand Down Expand Up @@ -286,7 +285,7 @@ jobs:
sudo mv go /usr/local
popd
set -x
make get_tools
make tools
make get_vendor_deps
make build-linux
make localnet-start
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ COPY . .

# Install minimum necessary dependencies, build Cosmos SDK, remove packages
RUN apk add --no-cache $PACKAGES && \
make get_tools && \
make tools && \
make get_vendor_deps && \
make build && \
make install
Expand Down
22 changes: 13 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ GOTOOLS = \
github.com/alecthomas/gometalinter \
github.com/rakyll/statik
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

########################################
### 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
Expand Down Expand Up @@ -117,33 +117,37 @@ check_tools:

update_tools:
@echo "--> Updating tools to correct version"
$(MAKE) --always-make get_tools
$(MAKE) --always-make tools

update_dev_tools:
@echo "--> Downloading linters (this may take awhile)"
$(GOPATH)/src/github.com/alecthomas/gometalinter/scripts/install.sh -b $(GOBIN)
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)"
$(GOPATH)/src/github.com/alecthomas/gometalinter/scripts/install.sh -b $(GOBIN)
go get github.com/tendermint/lint/golint
touch $@

get_vendor_deps: get_tools
get_vendor_deps: tools
@echo "--> Generating vendor directory via dep ensure"
@rm -rf .vendor-new
@dep ensure -v -vendor-only

update_vendor_deps: get_tools
update_vendor_deps: tools
@echo "--> Running dep ensure"
@rm -rf .vendor-new
@dep ensure -v

draw_deps: get_tools
draw_deps: 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

clean:
rm -f devtools-stamp

########################################
### Documentation
Expand Down Expand Up @@ -264,7 +268,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_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 \
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
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ Vagrant.configure("2") do |config|
chown vagrant:vagrant /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
end
14 changes: 14 additions & 0 deletions docs/DOCS_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
```
2 changes: 1 addition & 1 deletion docs/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cd $GOPATH/src/github.com/cosmos/cosmos-sdk
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 install_examples
```
Expand Down
2 changes: 1 addition & 1 deletion docs/gaia/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ mkdir -p $GOPATH/src/github.com/cosmos
cd $GOPATH/src/github.com/cosmos
git clone https://github.com/cosmos/cosmos-sdk
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.
Expand Down
9 changes: 4 additions & 5 deletions scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

###
# get_tools
# tools
###
all: get_tools
get_tools: $(GOPATH)/bin/dep $(GOPATH)/bin/gometalinter $(GOPATH)/bin/statik $(GOPATH)/bin/goimports
all: tools
tools: $(GOPATH)/bin/dep $(GOPATH)/bin/gometalinter $(GOPATH)/bin/statik $(GOPATH)/bin/goimports

$(GOPATH)/bin/dep:
$(call go_get,golang,dep,22125cfaa6ddc71e145b1535d4b7ee9744fefff2)
Expand All @@ -53,5 +53,4 @@ $(GOPATH)/bin/statik:
$(GOPATH)/bin/goimports:
go get golang.org/x/tools/cmd/goimports

.PHONY: all get_tools

.PHONY: all
2 changes: 1 addition & 1 deletion scripts/install/install_sdk_arm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ cd $GOPATH/src/$REPO

# build & install master
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 install

Expand Down
2 changes: 1 addition & 1 deletion scripts/install/install_sdk_bsd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ cd $GOPATH/src/$REPO

# build & install master
git checkout $BRANCH
gmake get_tools
gmake tools
gmake get_vendor_deps
gmake install
gmake install_examples
2 changes: 1 addition & 1 deletion scripts/install/install_sdk_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cd $GOPATH/src/$REPO

# build & install master
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 install

Expand Down

0 comments on commit 0c0bff7

Please sign in to comment.