-
Notifications
You must be signed in to change notification settings - Fork 115
/
Makefile
47 lines (35 loc) · 1.43 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Absolute github repository name.
REPO := github.com/infobloxopen/atlas-app-toolkit
# Build directory absolute path.
PROJECT_ROOT = $(CURDIR)
# Utility docker image to generate Go files from .proto definition.
# https://github.com/infobloxopen/atlas-gentool
GENTOOL_IMAGE := infoblox/atlas-gentool:latest
.PHONY: default
default: test
test: check-fmt vendor
go test -cover ./...
.PHONY: vendor
vendor:
go mod tidy
go mod vendor
check-fmt:
test -z `go fmt ./...`
.gen-query:
docker run --rm -v $(PROJECT_ROOT):/go/src/$(REPO)/v2 $(GENTOOL_IMAGE) \
--go_out=:. $(REPO)/query/collection_operators.proto
.gen-errdetails:
docker run --rm -v $(PROJECT_ROOT):/go/src/$(REPO)/v2 $(GENTOOL_IMAGE) \
--go_out=:. $(REPO)/rpc/errdetails/error_details.proto
.gen-errfields:
docker run --rm -v $(PROJECT_ROOT):/go/src/$(REPO)/v2 $(GENTOOL_IMAGE) \
--go_out=:. $(REPO)/rpc/errfields/error_fields.proto
.gen-servertestdata:
docker run --rm -v $(PROJECT_ROOT):/go/src/$(REPO)/v2 $(GENTOOL_IMAGE) \
--go_out=. --go-grpc_out=. --grpc-gateway_out=logtostderr=true:. $(REPO)/v2/server/testdata/test.proto
.PHONY: gen
gen: .gen-query .gen-errdetails .gen-errfields .gen-servertestdata
.PHONY: mocks
mocks:
GO111MODULE=off go get -u github.com/maxbrunsfeld/counterfeiter
counterfeiter --fake-name ServerStreamMock -o ./logging/mocks/server_stream.go $(GOPATH)/src/github.com/infobloxopen/atlas-app-toolkit/vendor/google.golang.org/grpc/stream.go ServerStream