forked from istio/api
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.core.mk
125 lines (93 loc) · 3.14 KB
/
Makefile.core.mk
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
# Copyright Istio Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
SHELL := /bin/bash
all: gen
########################
# setup
########################
repo_dir := .
protolock = protolock
annotations_prep = annotations_prep
htmlproofer = htmlproofer
cue = cue-gen -paths=common-protos
#####################
# Generation Rules
#####################
.PHONY: gen-proto
gen-proto:
./gen.sh
.PHONY: clean
clean:
./clean.sh
.PHONY: gen
gen: \
clean \
gen-proto \
generate-annotations \
generate-labels \
mirror-licenses \
tidy-go
gen-check: gen check-clean-repo
#####################
# annotation/...
#####################
annotations_path := annotation
annotations_pb_go := $(annotations_path)/annotations.gen.go
annotations_pb_doc := $(annotations_path)/annotations.pb.html
annotations_yaml := $(annotations_path)/annotations.yaml
$(annotations_pb_go) $(annotations_pb_doc): $(annotations_yaml)
@$(annotations_prep) --input $(annotations_yaml) --output $(annotations_pb_go) --html_output $(annotations_pb_doc) --collection_type annotation
generate-annotations: $(annotations_pb_go) $(annotations_pb_doc)
clean-annotations:
@rm -fr $(annotations_pb_go) $(annotations_pb_doc)
#####################
# label/...
#####################
labels_path := label
labels_pb_go := $(labels_path)/labels.gen.go
labels_pb_doc := $(labels_path)/labels.pb.html
labels_yaml := $(labels_path)/labels.yaml
$(labels_pb_go) $(labels_pb_doc): $(labels_yaml)
@$(annotations_prep) --input $(labels_yaml) --output $(labels_pb_go) --html_output $(labels_pb_doc) --collection_type label
generate-labels: $(labels_pb_go) $(labels_pb_doc)
clean-labels:
@rm -fr $(labels_pb_go) $(labels_pb_doc)
#####################
# Protolock
#####################
proto-commit:
@$(protolock) commit
proto-commit-force:
@$(protolock) commit --force
proto-status:
@$(protolock) status
#####################
# Misc
#####################
# lint-protos is different for istio/api. List all other lint-all targets and add local-lint-protos
local-lint-protos:
@buf lint
@./scripts/check-operator-proto.sh
lint: lint-dockerfiles lint-scripts lint-yaml lint-helm lint-copyright-banner lint-go lint-python lint-markdown lint-sass lint-typescript lint-licenses local-lint-protos
@$(htmlproofer) . --url-swap "istio.io:preliminary.istio.io" --assume-extension --check-html --check-external-hash --check-opengraph --timeframe 2d --storage-dir $(repo_dir)/.htmlproofer --url-ignore "/localhost/"
fmt: format-python
#####################
# CI System
#####################
presubmit: proto-commit lint
postsubmit: presubmit
#####################
# Common definitions
#####################
include common/Makefile.common.mk