tendermint/Makefile

113 lines
2.8 KiB
Makefile
Raw Normal View History

2017-06-01 20:32:55 -07:00
GOTOOLS = \
github.com/mitchellh/gox \
github.com/Masterminds/glide \
github.com/alecthomas/gometalinter \
2017-11-30 11:30:21 -08:00
github.com/ckaznocha/protoc-gen-lint \
github.com/gogo/protobuf/protoc-gen-gogo \
github.com/gogo/protobuf/gogoproto
2015-12-17 13:46:04 -08:00
2017-11-30 21:41:07 -08:00
INCLUDE = -I=. -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protobuf
all: install test
2016-01-30 19:36:33 -08:00
2017-11-14 10:53:40 -08:00
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
2016-11-09 17:12:29 -08:00
2017-11-09 13:19:59 -08:00
install_protoc:
# https://github.com/google/protobuf/releases
curl -L https://github.com/google/protobuf/releases/download/v3.4.1/protobuf-cpp-3.4.1.tar.gz | tar xvz && \
2017-11-20 15:09:18 -08:00
cd protobuf-3.4.1 && \
2017-11-09 13:19:59 -08:00
DIST_LANG=cpp ./configure && \
make && \
make install && \
cd .. && \
2017-11-20 15:09:18 -08:00
rm -rf protobuf-3.4.1
2017-01-10 06:59:29 -08:00
2016-01-30 19:36:33 -08:00
protoc:
## Note to self:
2017-11-09 13:19:59 -08:00
## On "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
## ldconfig (may require sudo)
## https://stackoverflow.com/a/25518702
protoc $(INCLUDE) --gogo_out=plugins=grpc:. --lint_out=. types/*.proto
2015-12-17 13:46:04 -08:00
2016-11-09 17:12:29 -08:00
install:
@ go install ./cmd/...
2015-12-17 13:46:04 -08:00
2017-01-16 22:33:48 -08:00
build:
@ go build -i ./cmd/...
2017-01-16 22:33:48 -08:00
2017-06-01 20:32:55 -07:00
dist:
2017-06-02 09:44:00 -07:00
@ bash scripts/dist.sh
2017-06-01 20:32:55 -07:00
@ bash scripts/publish.sh
test:
@ find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
2017-11-27 23:48:00 -08:00
@ echo "==> Running linter"
@ make metalinter_test
2017-11-27 11:52:06 -08:00
@ echo "==> Running go test"
2017-11-14 10:53:40 -08:00
@ go test $(PACKAGES)
2017-11-27 11:52:06 -08:00
test_race:
2017-11-27 11:52:06 -08:00
@ find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
@ echo "==> Running go test --race"
@go test -v -race $(PACKAGES)
test_integrations:
@ bash test.sh
2017-01-16 21:58:42 -08:00
fmt:
@ go fmt ./...
2015-12-17 13:46:04 -08:00
get_deps:
2017-11-14 10:53:40 -08:00
@ go get -d $(PACKAGES)
2016-11-09 17:12:29 -08:00
2017-11-27 23:48:00 -08:00
ensure_tools:
2017-06-01 20:32:55 -07:00
go get -u -v $(GOTOOLS)
2017-11-27 23:48:00 -08:00
@gometalinter --install
2017-06-01 20:32:55 -07:00
2017-11-27 23:48:00 -08:00
get_vendor_deps: ensure_tools
@rm -rf vendor/
@echo "--> Running glide install"
2017-01-16 21:58:42 -08:00
@ glide install
2017-06-01 20:32:55 -07:00
2017-11-27 23:48:00 -08:00
metalinter:
2017-11-30 21:41:07 -08:00
protoc $(INCLUDE) --lint_out=. types/*.proto
gometalinter --vendor --deadline=600s --enable-all --disable=lll ./...
2017-11-27 23:48:00 -08:00
metalinter_test:
2017-11-30 21:41:07 -08:00
protoc $(INCLUDE) --lint_out=. types/*.proto
gometalinter --vendor --deadline=600s --disable-all \
--enable=maligned \
--enable=deadcode \
2017-09-21 12:46:51 -07:00
--enable=goconst \
--enable=goimports \
--enable=gosimple \
--enable=ineffassign \
2017-09-21 12:46:51 -07:00
--enable=megacheck \
--enable=misspell \
2017-09-21 12:46:51 -07:00
--enable=staticcheck \
--enable=safesql \
--enable=structcheck \
2017-09-21 12:46:51 -07:00
--enable=unconvert \
--enable=unused \
--enable=varcheck \
2017-09-21 12:46:51 -07:00
--enable=vetshadow \
./...
2017-11-30 11:29:12 -08:00
#--enable=gas \
2017-10-18 11:21:16 -07:00
#--enable=dupl \
#--enable=errcheck \
#--enable=gocyclo \
#--enable=golint \ <== comments on anything exported
#--enable=gotype \
#--enable=interfacer \
#--enable=unparam \
#--enable=vet \
2017-11-09 13:59:09 -08:00
build-docker:
docker build -t "tendermint/abci-dev" -f Dockerfile.develop .
run-docker:
docker run -it --rm -v "$PWD:/go/src/github.com/tendermint/abci" -w "/go/src/github.com/tendermint/abci" "tendermint/abci-dev" /bin/bash
2017-11-27 23:48:00 -08:00
.PHONY: all build test fmt get_deps ensure_tools protoc install_protoc build-docker run-docker