You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
2.9 KiB

9 years ago
7 years ago
8 years ago
7 years ago
7 years ago
7 years ago
9 years ago
8 years ago
9 years ago
7 years ago
7 years ago
7 years ago
7 years ago
9 years ago
8 years ago
7 years ago
7 years ago
7 years ago
  1. GOTOOLS = \
  2. github.com/mitchellh/gox \
  3. github.com/Masterminds/glide \
  4. github.com/gogo/protobuf/protoc-gen-gogo \
  5. github.com/gogo/protobuf/gogoproto
  6. #gopkg.in/alecthomas/gometalinter.v2 \
  7. INCLUDE = -I=. -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protobuf
  8. all: protoc install test
  9. PACKAGES=$(shell go list ./... | grep -v '/vendor/')
  10. install_protoc:
  11. # https://github.com/google/protobuf/releases
  12. curl -L https://github.com/google/protobuf/releases/download/v3.4.1/protobuf-cpp-3.4.1.tar.gz | tar xvz && \
  13. cd protobuf-3.4.1 && \
  14. DIST_LANG=cpp ./configure && \
  15. make && \
  16. make install && \
  17. cd .. && \
  18. rm -rf protobuf-3.4.1
  19. protoc:
  20. ## Note to self:
  21. ## On "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
  22. ## ldconfig (may require sudo)
  23. ## https://stackoverflow.com/a/25518702
  24. protoc $(INCLUDE) --gogo_out=plugins=grpc:. types/*.proto
  25. @ echo "--> adding nolint declarations to protobuf generated files"
  26. @ awk '/package types/ { print "//nolint: gas"; print; next }1' types/types.pb.go > types/types.pb.go.new
  27. @ mv types/types.pb.go.new types/types.pb.go
  28. install:
  29. @ go install ./cmd/...
  30. build:
  31. @ go build -i ./cmd/...
  32. dist:
  33. @ bash scripts/dist.sh
  34. @ bash scripts/publish.sh
  35. test:
  36. @ find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
  37. @ echo "==> Running go test"
  38. @ go test $(PACKAGES)
  39. test_race:
  40. @ find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
  41. @ echo "==> Running go test --race"
  42. @ go test -v -race $(PACKAGES)
  43. test_integrations:
  44. @ bash test.sh
  45. fmt:
  46. @ go fmt ./...
  47. get_deps:
  48. @ go get -d $(PACKAGES)
  49. ensure_tools:
  50. go get -u -v $(GOTOOLS)
  51. #@ gometalinter.v2 --install
  52. get_vendor_deps: ensure_tools
  53. @ rm -rf vendor/
  54. @ echo "--> Running glide install"
  55. @ glide install
  56. metalinter_all:
  57. protoc $(INCLUDE) --lint_out=. types/*.proto
  58. gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./...
  59. metalinter:
  60. @ echo "==> Running linter"
  61. gometalinter.v2 --vendor --deadline=600s --disable-all \
  62. --enable=maligned \
  63. --enable=deadcode \
  64. --enable=goconst \
  65. --enable=goimports \
  66. --enable=gosimple \
  67. --enable=ineffassign \
  68. --enable=megacheck \
  69. --enable=misspell \
  70. --enable=staticcheck \
  71. --enable=safesql \
  72. --enable=structcheck \
  73. --enable=unconvert \
  74. --enable=unused \
  75. --enable=varcheck \
  76. --enable=vetshadow \
  77. ./...
  78. #--enable=gas \
  79. #--enable=dupl \
  80. #--enable=errcheck \
  81. #--enable=gocyclo \
  82. #--enable=golint \ <== comments on anything exported
  83. #--enable=gotype \
  84. #--enable=interfacer \
  85. #--enable=unparam \
  86. #--enable=vet \
  87. build-docker:
  88. docker build -t "tendermint/abci-dev" -f Dockerfile.develop .
  89. run-docker:
  90. docker run -it --rm -v "$PWD:/go/src/github.com/tendermint/abci" -w "/go/src/github.com/tendermint/abci" "tendermint/abci-dev" /bin/bash
  91. .PHONY: all build test fmt get_deps ensure_tools protoc install_protoc build-docker run-docker