2017-10-03 11:54:19 +00:00
|
|
|
.PHONY: statusgo all test xgo clean help
|
2016-07-20 06:42:19 +00:00
|
|
|
.PHONY: statusgo-android statusgo-ios
|
|
|
|
|
2016-06-18 18:28:08 +00:00
|
|
|
GOBIN = build/bin
|
2016-06-17 11:55:54 +00:00
|
|
|
GO ?= latest
|
|
|
|
|
2017-10-03 11:54:19 +00:00
|
|
|
# This is a code for automatic help generator.
|
|
|
|
# It supports ANSI colors and categories.
|
|
|
|
# To add new item into help output, simply add comments
|
|
|
|
# starting with '##'. To add category, use @category.
|
|
|
|
GREEN := $(shell tput -Txterm setaf 2)
|
|
|
|
WHITE := $(shell tput -Txterm setaf 7)
|
|
|
|
YELLOW := $(shell tput -Txterm setaf 3)
|
|
|
|
RESET := $(shell tput -Txterm sgr0)
|
|
|
|
HELP_FUN = \
|
|
|
|
%help; \
|
|
|
|
while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^([a-zA-Z\-]+)\s*:.*\#\#(?:@([a-zA-Z\-]+))?\s(.*)$$/ }; \
|
|
|
|
print "Usage: make [target]\n\n"; \
|
|
|
|
for (sort keys %help) { \
|
|
|
|
print "${WHITE}$$_:${RESET}\n"; \
|
|
|
|
for (@{$$help{$$_}}) { \
|
|
|
|
$$sep = " " x (32 - length $$_->[0]); \
|
|
|
|
print " ${YELLOW}$$_->[0]${RESET}$$sep${GREEN}$$_->[1]${RESET}\n"; \
|
|
|
|
}; \
|
|
|
|
print "\n"; \
|
|
|
|
}
|
|
|
|
|
|
|
|
help: ##@other Show this help
|
|
|
|
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)
|
|
|
|
|
|
|
|
# Main targets
|
|
|
|
|
|
|
|
statusgo: ##@build Build status-go as statusd server
|
2017-03-28 09:04:52 +00:00
|
|
|
build/env.sh go build -i -o $(GOBIN)/statusd -v $(shell build/testnet-flags.sh) ./cmd/statusd
|
|
|
|
@echo "\nCompilation done.\nRun \"build/bin/statusd help\" to view available commands."
|
2016-06-17 11:55:54 +00:00
|
|
|
|
2016-07-20 06:42:19 +00:00
|
|
|
statusgo-cross: statusgo-android statusgo-ios
|
2016-10-13 11:46:54 +00:00
|
|
|
@echo "Full cross compilation done."
|
2016-07-20 06:42:19 +00:00
|
|
|
@ls -ld $(GOBIN)/statusgo-*
|
|
|
|
|
2017-10-03 11:54:19 +00:00
|
|
|
statusgo-android: xgo ##@cross-compile Build status-go for Android
|
2017-03-28 09:04:52 +00:00
|
|
|
build/env.sh $(GOBIN)/xgo --image farazdagi/xgo --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=android-16/aar -v $(shell build/testnet-flags.sh) ./cmd/statusd
|
2016-10-13 11:46:54 +00:00
|
|
|
@echo "Android cross compilation done."
|
2016-06-17 11:55:54 +00:00
|
|
|
|
2017-10-03 11:54:19 +00:00
|
|
|
statusgo-ios: xgo ##@cross-compile Build status-go for iOS
|
2017-03-28 09:04:52 +00:00
|
|
|
build/env.sh $(GOBIN)/xgo --image farazdagi/xgo --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=ios-9.3/framework -v $(shell build/testnet-flags.sh) ./cmd/statusd
|
2016-10-13 11:46:54 +00:00
|
|
|
@echo "iOS framework cross compilation done."
|
2016-07-20 06:42:19 +00:00
|
|
|
|
2017-10-03 11:54:19 +00:00
|
|
|
statusgo-ios-simulator: xgo ##@cross-compile Build status-go for iOS Simulator
|
2016-12-15 23:00:08 +00:00
|
|
|
@build/env.sh docker pull farazdagi/xgo-ios-simulator
|
2017-03-28 09:04:52 +00:00
|
|
|
build/env.sh $(GOBIN)/xgo --image farazdagi/xgo-ios-simulator --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=ios-9.3/framework -v $(shell build/testnet-flags.sh) ./cmd/statusd
|
2016-10-13 11:46:54 +00:00
|
|
|
@echo "iOS framework cross compilation done."
|
2016-07-20 06:42:19 +00:00
|
|
|
|
2016-06-17 11:55:54 +00:00
|
|
|
xgo:
|
2016-09-22 19:31:05 +00:00
|
|
|
build/env.sh docker pull farazdagi/xgo
|
2016-06-18 18:28:08 +00:00
|
|
|
build/env.sh go get github.com/karalabe/xgo
|
2016-07-20 06:42:19 +00:00
|
|
|
|
2016-10-13 11:46:54 +00:00
|
|
|
statusgo-mainnet:
|
2017-03-28 09:04:52 +00:00
|
|
|
build/env.sh go build -i -o $(GOBIN)/statusgo -v $(shell build/mainnet-flags.sh) ./cmd/statusd
|
2016-10-13 11:46:54 +00:00
|
|
|
@echo "status go compilation done (mainnet)."
|
|
|
|
@echo "Run \"build/bin/statusgo\" to view available commands"
|
|
|
|
|
|
|
|
statusgo-android-mainnet: xgo
|
2017-03-28 09:04:52 +00:00
|
|
|
build/env.sh $(GOBIN)/xgo --image farazdagi/xgo --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=android-16/aar -v $(shell build/mainnet-flags.sh) ./cmd/statusd
|
2016-10-13 11:46:54 +00:00
|
|
|
@echo "Android cross compilation done (mainnet)."
|
|
|
|
|
|
|
|
statusgo-ios-mainnet: xgo
|
2017-03-28 09:04:52 +00:00
|
|
|
build/env.sh $(GOBIN)/xgo --image farazdagi/xgo --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=ios-9.3/framework -v $(shell build/mainnet-flags.sh) ./cmd/statusd
|
2016-10-13 11:46:54 +00:00
|
|
|
@echo "iOS framework cross compilation done (mainnet)."
|
|
|
|
|
|
|
|
statusgo-ios-simulator-mainnet: xgo
|
2017-03-28 09:04:52 +00:00
|
|
|
build/env.sh $(GOBIN)/xgo --image farazdagi/xgo-ios-simulator --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=ios-9.3/framework -v $(shell build/mainnet-flags.sh) ./cmd/statusd
|
2016-10-13 11:46:54 +00:00
|
|
|
@echo "iOS framework cross compilation done (mainnet)."
|
|
|
|
|
2017-09-04 12:56:58 +00:00
|
|
|
ci: mock
|
2017-09-18 12:13:32 +00:00
|
|
|
build/env.sh go test -timeout 40m -v ./geth/api/...
|
2017-07-13 06:54:10 +00:00
|
|
|
build/env.sh go test -timeout 40m -v ./geth/common
|
|
|
|
build/env.sh go test -timeout 40m -v ./geth/jail
|
|
|
|
build/env.sh go test -timeout 40m -v ./geth/node
|
|
|
|
build/env.sh go test -timeout 40m -v ./geth/params
|
|
|
|
build/env.sh go test -timeout 40m -v ./extkeys
|
2017-09-01 14:09:11 +00:00
|
|
|
build/env.sh go test -timeout 1m -v ./helpers/...
|
2016-09-28 08:07:30 +00:00
|
|
|
|
2017-10-03 11:54:19 +00:00
|
|
|
generate: ##@other Regenerate assets and other auto-generated stuff
|
2017-05-01 07:51:59 +00:00
|
|
|
cp ./node_modules/web3/dist/web3.js ./static/scripts/web3.js
|
2017-04-06 19:36:55 +00:00
|
|
|
build/env.sh go generate ./static
|
2017-05-01 07:51:59 +00:00
|
|
|
rm ./static/scripts/web3.js
|
2017-04-06 19:36:55 +00:00
|
|
|
|
2017-05-03 14:24:48 +00:00
|
|
|
lint-deps:
|
|
|
|
go get -u github.com/alecthomas/gometalinter
|
|
|
|
gometalinter --install
|
|
|
|
|
|
|
|
lint-cur:
|
|
|
|
gometalinter --disable-all --enable=deadcode extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
|
2017-10-03 11:54:19 +00:00
|
|
|
lint: ##@tests Run meta linter on code
|
2017-05-03 14:24:48 +00:00
|
|
|
@echo "Linter: go vet\n--------------------"
|
|
|
|
@gometalinter --disable-all --enable=vet extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: go vet --shadow\n--------------------"
|
|
|
|
@gometalinter --disable-all --enable=vetshadow extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: gofmt\n--------------------"
|
|
|
|
@gometalinter --disable-all --enable=gofmt extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: goimports\n--------------------"
|
|
|
|
@gometalinter --disable-all --enable=goimports extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: golint\n--------------------"
|
|
|
|
@gometalinter --disable-all --enable=golint extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: deadcode\n--------------------"
|
|
|
|
@gometalinter --disable-all --enable=deadcode extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: misspell\n--------------------"
|
|
|
|
@gometalinter --disable-all --enable=misspell extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: unparam\n--------------------"
|
|
|
|
@gometalinter --disable-all --deadline 45s --enable=unparam extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: unused\n--------------------"
|
|
|
|
@gometalinter --disable-all --deadline 45s --enable=unused extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: gocyclo\n--------------------"
|
|
|
|
@gometalinter --disable-all --enable=gocyclo extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: errcheck\n--------------------"
|
|
|
|
@gometalinter --disable-all --enable=errcheck extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: dupl\n--------------------"
|
|
|
|
@gometalinter --disable-all --enable=dupl extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: ineffassign\n--------------------"
|
|
|
|
@gometalinter --disable-all --enable=ineffassign extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: interfacer\n--------------------"
|
|
|
|
@gometalinter --disable-all --enable=interfacer extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: unconvert\n--------------------"
|
|
|
|
@gometalinter --disable-all --enable=unconvert extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: goconst\n--------------------"
|
|
|
|
@gometalinter --disable-all --enable=goconst extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: staticcheck\n--------------------"
|
|
|
|
@gometalinter --disable-all --deadline 45s --enable=staticcheck extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: gas\n--------------------"
|
|
|
|
@gometalinter --disable-all --enable=gas extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: varcheck\n--------------------"
|
|
|
|
@gometalinter --disable-all --deadline 60s --enable=varcheck extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: structcheck\n--------------------"
|
|
|
|
@gometalinter --disable-all --enable=structcheck extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
@echo "Linter: gosimple\n--------------------"
|
|
|
|
@gometalinter --disable-all --deadline 45s --enable=gosimple extkeys cmd/... geth/... | grep -v -f ./static/config/linter_exclude_list.txt || echo "OK!"
|
|
|
|
|
2017-09-04 12:56:58 +00:00
|
|
|
mock-install:
|
|
|
|
go get -u github.com/golang/mock/mockgen
|
|
|
|
|
2017-10-03 11:54:19 +00:00
|
|
|
mock: mock-install ##@other Regenerate mocks
|
2017-09-04 12:56:58 +00:00
|
|
|
mockgen -source=geth/common/types.go -destination=geth/common/types_mock.go -package=common
|
|
|
|
|
2017-10-03 11:54:19 +00:00
|
|
|
test: ##@tests Run tests
|
2016-09-11 11:44:14 +00:00
|
|
|
@build/env.sh echo "mode: set" > coverage-all.out
|
2017-05-16 12:09:52 +00:00
|
|
|
build/env.sh go test -coverprofile=coverage.out -covermode=set ./geth/api
|
2017-03-14 22:57:07 +00:00
|
|
|
@build/env.sh tail -n +2 coverage.out >> coverage-all.out
|
2017-05-16 12:09:52 +00:00
|
|
|
build/env.sh go test -coverprofile=coverage.out -covermode=set ./geth/common
|
2017-03-15 21:03:01 +00:00
|
|
|
@build/env.sh tail -n +2 coverage.out >> coverage-all.out
|
2017-03-14 22:57:07 +00:00
|
|
|
build/env.sh go test -coverprofile=coverage.out -covermode=set ./geth/jail
|
2016-09-11 11:44:14 +00:00
|
|
|
@build/env.sh tail -n +2 coverage.out >> coverage-all.out
|
2017-05-16 12:09:52 +00:00
|
|
|
build/env.sh go test -coverprofile=coverage.out -covermode=set ./geth/node
|
|
|
|
@build/env.sh tail -n +2 coverage.out >> coverage-all.out
|
|
|
|
build/env.sh go test -coverprofile=coverage.out -covermode=set ./geth/params
|
|
|
|
@build/env.sh tail -n +2 coverage.out >> coverage-all.out
|
2016-09-11 11:44:14 +00:00
|
|
|
build/env.sh go test -coverprofile=coverage.out -covermode=set ./extkeys
|
|
|
|
@build/env.sh tail -n +2 coverage.out >> coverage-all.out
|
2017-03-28 09:04:52 +00:00
|
|
|
build/env.sh go test -coverprofile=coverage.out -covermode=set ./cmd/statusd
|
2016-11-05 17:12:24 +00:00
|
|
|
@build/env.sh tail -n +2 coverage.out >> coverage-all.out
|
2016-09-11 11:44:14 +00:00
|
|
|
@build/env.sh go tool cover -html=coverage-all.out -o coverage.html
|
|
|
|
@build/env.sh go tool cover -func=coverage-all.out
|
|
|
|
|
2017-05-16 12:09:52 +00:00
|
|
|
test-api:
|
|
|
|
build/env.sh go test -v -coverprofile=coverage.out -coverpkg=./geth/node ./geth/api
|
2017-03-14 22:57:07 +00:00
|
|
|
@build/env.sh go tool cover -html=coverage.out -o coverage.html
|
|
|
|
@build/env.sh go tool cover -func=coverage.out
|
|
|
|
|
2017-05-16 12:09:52 +00:00
|
|
|
test-common:
|
|
|
|
build/env.sh go test -v -coverprofile=coverage.out ./geth/common
|
2017-03-15 21:03:01 +00:00
|
|
|
@build/env.sh go tool cover -html=coverage.out -o coverage.html
|
|
|
|
@build/env.sh go tool cover -func=coverage.out
|
|
|
|
|
2017-03-14 22:57:07 +00:00
|
|
|
test-jail:
|
|
|
|
build/env.sh go test -v -coverprofile=coverage.out ./geth/jail
|
2016-09-11 11:44:14 +00:00
|
|
|
@build/env.sh go tool cover -html=coverage.out -o coverage.html
|
|
|
|
@build/env.sh go tool cover -func=coverage.out
|
|
|
|
|
2017-05-16 12:09:52 +00:00
|
|
|
test-node:
|
|
|
|
build/env.sh go test -v -coverprofile=coverage.out ./geth/node
|
|
|
|
@build/env.sh go tool cover -html=coverage.out -o coverage.html
|
|
|
|
@build/env.sh go tool cover -func=coverage.out
|
|
|
|
|
|
|
|
test-params:
|
|
|
|
build/env.sh go test -v -coverprofile=coverage.out ./geth/params
|
|
|
|
@build/env.sh go tool cover -html=coverage.out -o coverage.html
|
|
|
|
@build/env.sh go tool cover -func=coverage.out
|
|
|
|
|
2016-09-11 11:44:14 +00:00
|
|
|
test-extkeys:
|
|
|
|
build/env.sh go test -v -coverprofile=coverage.out ./extkeys
|
|
|
|
@build/env.sh go tool cover -html=coverage.out -o coverage.html
|
|
|
|
@build/env.sh go tool cover -func=coverage.out
|
2016-07-20 06:42:19 +00:00
|
|
|
|
2016-12-07 21:07:08 +00:00
|
|
|
test-cmd:
|
2017-03-28 09:04:52 +00:00
|
|
|
build/env.sh go test -v -coverprofile=coverage.out ./cmd/statusd
|
2016-12-07 21:07:08 +00:00
|
|
|
@build/env.sh go tool cover -html=coverage.out -o coverage.html
|
|
|
|
@build/env.sh go tool cover -func=coverage.out
|
|
|
|
|
2017-10-03 11:54:19 +00:00
|
|
|
clean: ##@other Cleanup
|
2016-07-20 06:42:19 +00:00
|
|
|
rm -fr build/bin/*
|
2016-09-11 11:44:14 +00:00
|
|
|
rm coverage.out coverage-all.out coverage.html
|