forked from infobloxopen/atlas-app-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (37 loc) · 1.48 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
48
49
50
# Absolute github repository name.
REPO := github.com/infobloxopen/atlas-app-toolkit
# Build directory absolute path.
PROJECT_ROOT = $(CURDIR)
# Utility docker image to build Go binaries
# https://github.com/infobloxopen/buildtool
BUILDTOOL_IMAGE := infoblox/buildtool:v8
# Utility docker image to generate Go files from .proto definition.
# https://github.com/infobloxopen/atlas-gentool
GENTOOL_IMAGE := infoblox/atlas-gentool:v3
BUILDER := docker run --rm -v $(PROJECT_ROOT):/go/src/$(REPO) -w /go/src/$(REPO) $(BUILDTOOL_IMAGE)
# Set BUILD_TYPE environment variable to "local" in order to use local go instance instead of buildtool
ifeq ($(BUILD_TYPE), local)
BUILDER :=
endif
.PHONY: default
default: test
test: check-fmt vendor
$(BUILDER) go test ./...
vendor:
$(BUILDER) dep ensure
check-fmt:
test -z `$(BUILDER) go fmt ./...`
.gen-op:
docker run --rm -v $(PROJECT_ROOT):/go/src/$(REPO) $(GENTOOL_IMAGE) \
--go_out=:. $(REPO)/op/collection_operators.proto
.gen-errdetails:
docker run --rm -v $(PROJECT_ROOT):/go/src/$(REPO) $(GENTOOL_IMAGE) \
--go_out=:. $(REPO)/rpc/errdetails/error_details.proto
.gen-errfields:
docker run --rm -v $(PROJECT_ROOT):/go/src/$(REPO) $(GENTOOL_IMAGE) \
--go_out=:. $(REPO)/rpc/errfields/error_fields.proto
.gen-servertestdata:
docker run --rm -v $(PROJECT_ROOT):/go/src/$(REPO) $(GENTOOL_IMAGE) \
--go_out=plugins=grpc:. --grpc-gateway_out=logtostderr=true:. $(REPO)/server/testdata/test.proto
.PHONY: gen
gen: .gen-op .gen-errdetails .gen-errfields