2017-06-01 20:32:55 -07:00
|
|
|
GOTOOLS = \
|
|
|
|
github.com/mitchellh/gox \
|
2017-09-21 12:21:08 -07:00
|
|
|
github.com/Masterminds/glide \
|
2017-11-09 14:15:09 -08:00
|
|
|
github.com/alecthomas/gometalinter \
|
|
|
|
github.com/ckaznocha/protoc-gen-lint
|
2015-12-17 13:46:04 -08:00
|
|
|
|
2017-11-09 14:16:06 -08:00
|
|
|
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
|
|
|
go get github.com/golang/protobuf/protoc-gen-go
|
|
|
|
|
2016-01-30 19:36:33 -08:00
|
|
|
protoc:
|
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 --go_out=plugins=grpc:. types/*.proto
|
2015-12-17 13:46:04 -08:00
|
|
|
|
2016-11-09 17:12:29 -08:00
|
|
|
install:
|
2017-11-08 14:18:52 -08:00
|
|
|
@ go install ./cmd/...
|
2015-12-17 13:46:04 -08:00
|
|
|
|
2017-01-16 22:33:48 -08:00
|
|
|
build:
|
2017-11-08 14:18:52 -08:00
|
|
|
@ 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
|
|
|
|
|
2017-01-12 03:37:47 -08:00
|
|
|
# test.sh requires that we run the installed cmds, must not be out of date
|
|
|
|
test: install
|
2017-11-21 16:11:23 -08:00
|
|
|
@ find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
|
|
|
|
@ echo "==> Running unit tests"
|
2017-11-14 10:53:40 -08:00
|
|
|
@ go test $(PACKAGES)
|
2017-11-21 16:11:23 -08:00
|
|
|
@ echo "==> Running integration tests (./tests)"
|
2017-01-16 21:58:42 -08:00
|
|
|
@ bash tests/test.sh
|
|
|
|
|
|
|
|
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-06-01 20:32:55 -07:00
|
|
|
tools:
|
|
|
|
go get -u -v $(GOTOOLS)
|
|
|
|
|
2016-11-09 17:12:29 -08:00
|
|
|
get_vendor_deps:
|
2017-01-16 21:58:42 -08:00
|
|
|
@ go get github.com/Masterminds/glide
|
|
|
|
@ glide install
|
2017-06-01 20:32:55 -07:00
|
|
|
|
2017-09-21 12:21:08 -07:00
|
|
|
metalinter: tools
|
|
|
|
@gometalinter --install
|
2017-11-09 14:15:09 -08:00
|
|
|
protoc --lint_out=. types/*.proto
|
2017-09-21 12:21:08 -07:00
|
|
|
gometalinter --vendor --deadline=600s --enable-all --disable=lll ./...
|
|
|
|
|
|
|
|
metalinter_test: tools
|
|
|
|
@gometalinter --install
|
2017-11-09 14:15:09 -08:00
|
|
|
# protoc --lint_out=. types/*.proto
|
2017-09-21 12:21:08 -07:00
|
|
|
gometalinter --vendor --deadline=600s --disable-all \
|
2017-10-19 06:12:27 -07:00
|
|
|
--enable=maligned \
|
2017-09-21 12:21:08 -07:00
|
|
|
--enable=deadcode \
|
|
|
|
--enable=gas \
|
2017-09-21 12:46:51 -07:00
|
|
|
--enable=goconst \
|
2017-09-21 12:21:08 -07:00
|
|
|
--enable=goimports \
|
|
|
|
--enable=gosimple \
|
|
|
|
--enable=ineffassign \
|
2017-09-21 12:46:51 -07:00
|
|
|
--enable=megacheck \
|
2017-09-21 12:21:08 -07:00
|
|
|
--enable=misspell \
|
2017-09-21 12:46:51 -07:00
|
|
|
--enable=staticcheck \
|
2017-09-21 12:21:08 -07:00
|
|
|
--enable=safesql \
|
|
|
|
--enable=structcheck \
|
2017-09-21 12:46:51 -07:00
|
|
|
--enable=unconvert \
|
|
|
|
--enable=unused \
|
2017-09-21 12:21:08 -07:00
|
|
|
--enable=varcheck \
|
2017-09-21 12:46:51 -07:00
|
|
|
--enable=vetshadow \
|
2017-09-21 12:21:08 -07:00
|
|
|
./...
|
|
|
|
|
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-09-21 12:21:08 -07:00
|
|
|
|
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
|
|
|
|
|
|
|
|
.PHONY: all build test fmt get_deps tools protoc install_protoc build-docker run-docker
|