This repository has been archived by the owner on Sep 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.bazel
224 lines (195 loc) · 4.61 KB
/
BUILD.bazel
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("//build/nfpm:rules.bzl", "nfpm_pkg")
load("@bazel_skylib//lib:selects.bzl", "selects")
filegroup(
name = "srcs",
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
filegroup(
name = "distribution_srcs",
srcs = glob(["distribution/**"]),
visibility = ["//visibility:public"],
)
filegroup(
name = "rockspec_srcs",
srcs = glob(["*.rockspec"]),
visibility = ["//visibility:public"],
)
filegroup(
name = "plugins_ee_rockspec_srcs",
srcs = glob(["plugins-ee/**/*.rockspec"]),
visibility = ["//visibility:public"],
)
nfpm_pkg(
name = "kong_deb",
config = "//build:package/nfpm.yaml",
packager = "deb",
pkg_name = "kong",
visibility = ["//visibility:public"],
)
nfpm_pkg(
name = "kong_apk",
config = "//build:package/nfpm.yaml",
packager = "apk",
pkg_name = "kong",
visibility = ["//visibility:public"],
)
nfpm_pkg(
name = "kong_el8",
config = "//build:package/nfpm.yaml",
packager = "rpm",
pkg_name = "kong.el8",
visibility = ["//visibility:public"],
)
nfpm_pkg(
name = "kong_el7",
config = "//build:package/nfpm.yaml",
env = {
"RPM_EXTRA_DEPS": "hostname",
},
packager = "rpm",
pkg_name = "kong.el7",
visibility = ["//visibility:public"],
)
nfpm_pkg(
name = "kong_aws2",
config = "//build:package/nfpm.yaml",
env = {
"RPM_EXTRA_DEPS": "/usr/sbin/useradd",
"RPM_EXTRA_DEPS_2": "/usr/sbin/groupadd",
},
packager = "rpm",
pkg_name = "kong.aws2",
visibility = ["//visibility:public"],
)
nfpm_pkg(
name = "kong_aws2022",
config = "//build:package/nfpm.yaml",
env = {
"RPM_EXTRA_DEPS": "/usr/sbin/useradd",
"RPM_EXTRA_DEPS_2": "/usr/sbin/groupadd",
"RPM_EXTRA_DEPS_3": "libxcrypt-compat",
},
packager = "rpm",
pkg_name = "kong.aws2022",
visibility = ["//visibility:public"],
)
###### flags
# --//:debug=true
bool_flag(
name = "debug",
build_setting_default = True,
)
config_setting(
name = "debug_flag",
flag_values = {
":debug": "true",
},
visibility = ["//visibility:public"],
)
config_setting(
name = "debug_linux_flag",
constraint_values = [
"@platforms//os:linux",
],
flag_values = {
":debug": "true",
},
visibility = ["//visibility:public"],
)
# --//:licensing=false
bool_flag(
name = "licensing",
build_setting_default = False,
)
config_setting(
name = "licensing_flag",
flag_values = {
":licensing": "true",
},
visibility = ["//visibility:public"],
)
# --//:fips=false
bool_flag(
name = "fips",
build_setting_default = False,
)
config_setting(
name = "fips_flag",
flag_values = {
":fips": "true",
},
visibility = ["//visibility:public"],
)
##### constraints, platforms and config_settings for cross-compile
constraint_setting(name = "libc_version")
constraint_value(
name = "glibc_2_35",
constraint_setting = ":libc_version",
)
constraint_value(
name = "musl",
constraint_setting = ":libc_version",
visibility = ["//visibility:public"],
)
# platform sets the constraint values based on user input (--platform=//:PLATFOTM)
platform(
name = "ubuntu-22.04-x86_64",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
":glibc_2_35",
],
)
platform(
name = "ubuntu-22.04-arm64",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:arm64",
":glibc_2_35",
],
)
platform(
name = "alpine-x86_64",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
":musl",
],
)
platform(
name = "macos-arm64",
constraint_values = [
"@platforms//os:macos",
"@platforms//cpu:arm64",
],
)
# config_settings define a select() condition based on user-set constraint_values
# see https://bazel.build/docs/configurable-attributes
config_setting(
name = "arm64-linux-gnu-cross",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:arm64",
],
visibility = ["//visibility:public"],
)
config_setting(
name = "x86_64-linux-musl-cross",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
":musl",
],
visibility = ["//visibility:public"],
)
selects.config_setting_group(
# matches all cross build platforms
name = "any-cross",
match_any = [
":arm64-linux-gnu-cross",
":x86_64-linux-musl-cross",
],
visibility = ["//visibility:public"],
)