forked from EnMasseProject/enmasse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
184 lines (137 loc) · 3.88 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
TOPDIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(TOPDIR)/Makefile.env.mk
GO_DIRS = \
controller-manager \
iot/iot-proxy-configurator \
console/console-server \
access-control-server \
broker-plugin
DOCKER_DIRS = \
console/console-init \
olm-manifest \
iot/iot-tenant-service \
iot/iot-auth-service \
iot/iot-tenant-cleaner \
iot/images/iot-adapters \
iot/images/iot-device-registry \
FULL_BUILD = true
GO ?= go
GOOPTS ?= -mod=vendor
DOCKER_TARGETS = docker_build docker_tag docker_push kind_load_image clean
INSTALLDIR = $(CURDIR)/templates/install
SKIP_TESTS ?= false
SKIP_VERIFY_CODEGEN ?= false
SKIP_MANIFESTS ?= false
MAVEN_BATCH ?= true
ifndef GOPATH
GOPATH=/tmp/go
endif
ifeq ($(SKIP_TESTS),true)
MAVEN_ARGS+=-DskipTests -Dmaven.test.skip=true
endif
ifeq ($(MAVEN_BATCH),true)
MAVEN_ARGS+=-B
endif
all: build_java build_go templates
templates: imageenv manifests
$(MAKE) -C templates
deploy: build_go
$(IMAGE_ENV) IMAGE_ENV="$(IMAGE_ENV)" mvn -Prelease deploy $(MAVEN_ARGS)
build_java: build_go templates
$(IMAGE_ENV) IMAGE_ENV="$(IMAGE_ENV)" mvn package -q $(MAVEN_ARGS)
build_go: $(GO_DIRS) test_go
imageenv:
@echo $(IMAGE_ENV) > imageenv.txt
imagelist:
@echo $(IMAGE_LIST) > imagelist.txt
$(GO_DIRS):
$(MAKE) FULL_BUILD=$(FULL_BUILD) -C $@ $(MAKECMDGOALS)
ifeq ($(SKIP_TESTS),true)
test_go:
else
test_go: test_go_vet test_go_codegen test_go_run
endif
test_go_codegen:
ifeq ($(SKIP_VERIFY_CODEGEN),false)
GO111MODULE=on GO=$(GO) ./hack/verify-codegen.sh
endif
test_go_vet:
GO111MODULE=on time $(GO) vet $(GOOPTS) ./cmd/... ./pkg/...
ifeq (,$(GO2XUNIT))
test_go_run:
GO111MODULE=on $(GO) test $(GOOPTS) -v ./...
else
test_go_run:
mkdir -p build
GO111MODULE=on $(GO) test $(GOOPTS) -v ./... 2>&1 | tee $(abspath build/go.testoutput)
$(GO2XUNIT) -fail -input build/go.testoutput -output build/TEST-go.xml
endif
coverage_go:
GO111MODULE=on $(GO) test $(GOOPTS) -cover ./...
buildpush:
time $(MAKE)
time $(MAKE) docker_build
time $(MAKE) -j 4 docker_tag
time $(MAKE) -j 4 docker_push
buildpushkind:
time $(MAKE)
time $(MAKE) docker_build
time $(MAKE) -j 4 docker_tag
time $(MAKE) kind_load_image
clean_java:
mvn -q clean $(MAVEN_ARGS)
template_clean:
$(MAKE) -C templates clean
clean: clean_java clean_go docu_clean template_clean
rm -rf build
clean_go:
rm -Rf go-bin
coverage: java_coverage
$(MAKE) FULL_BUILD=$(FULL_BUILD) -C $@ coverage
java_coverage:
mvn test -Pcoverage $(MAVEN_ARGS)
mvn jacoco:report-aggregate $(MAVEN_ARGS)
$(DOCKER_TARGETS): $(DOCKER_DIRS) $(GO_DIRS)
$(DOCKER_DIRS):
$(MAKE) FULL_BUILD=$(FULL_BUILD) -C $@ $(MAKECMDGOALS)
systemtests:
make -C systemtests
systemtests-tekton:
make -C systemtests systemtests-tekton
docu_html:
make -C documentation
docu_check:
make -C documentation check
docu_clean:
make -C documentation clean
#region Targets related to kubebuilder
ifeq (, $(shell which controller-gen 2>/dev/null))
LOCALBIN:=$(TOPDIR)/local/go/bin
CONTROLLER_GEN:=$(abspath $(LOCALBIN)/controller-gen )
controller-gen: $(CONTROLLER_GEN)
$(CONTROLLER_GEN):
@mkdir -p "$(LOCALBIN)"
@{ \
set -e ;\
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
$(GO) mod init tmp ;\
GOPATH=$(abspath $(LOCALBIN)/../) $(GO) get sigs.k8s.io/controller-tools/cmd/[email protected] ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
else
controller-gen:
.PHONY: controller-gen
CONTROLLER_GEN:=$(shell which controller-gen)
endif
ifeq ($(SKIP_MANIFESTS),true)
manifests:
@echo "Skipping generating manifests from source"
else
manifests: controller-gen
$(CONTROLLER_GEN) crd paths=./pkg/apis/enmasse/v1 output:dir=./templates/crds
endif
#endregion
.PHONY: test_go_vet test_go_plain build_go imageenv buildpushkind
.PHONY: all $(GO_DIRS) $(DOCKER_TARGETS) $(DOCKER_DIRS) build_java test_go systemtests clean_java docu_html docu_check docu_clean templates
.PHONY: manifests