blob: 4818aa2bd455092da77194ad47f48d8a97788ae0 [file] [log] [blame]
Alex Perryb3b50792020-01-18 16:13:45 -08001load("//aos/seasocks:gen_embedded.bzl", "gen_embedded")
2load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_ts_library")
Austin Schuhe84c3ed2019-12-14 15:29:48 -08003load("//aos:config.bzl", "aos_config")
4
Brian Silverman7a7c24d2018-09-01 17:49:09 -07005package(default_visibility = ["//visibility:public"])
Brian Silverman100534c2015-09-07 15:51:23 -04006
Austin Schuhe84c3ed2019-12-14 15:29:48 -08007flatbuffer_cc_library(
8 name = "connect_fbs",
9 srcs = ["connect.fbs"],
10 gen_reflections = 1,
11 includes = [
12 "//aos:configuration_fbs_includes",
13 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080014 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -080015)
16
Alex Perryd5e13572020-02-22 15:15:08 -080017flatbuffer_ts_library(
18 name = "connect_ts_fbs",
19 srcs = ["connect.fbs"],
20 includes = [
21 "//aos:configuration_fbs_includes",
22 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080023 target_compatible_with = ["@platforms//os:linux"],
Alex Perryd5e13572020-02-22 15:15:08 -080024)
25
Austin Schuhe84c3ed2019-12-14 15:29:48 -080026flatbuffer_cc_library(
Austin Schuh7bc59052020-02-16 23:48:33 -080027 name = "timestamp_fbs",
28 srcs = ["timestamp.fbs"],
29 gen_reflections = 1,
30 includes = [
31 "//aos:configuration_fbs_includes",
32 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080033 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh7bc59052020-02-16 23:48:33 -080034)
35
36flatbuffer_cc_library(
Austin Schuhe84c3ed2019-12-14 15:29:48 -080037 name = "message_bridge_client_fbs",
38 srcs = ["message_bridge_client.fbs"],
39 gen_reflections = 1,
40 includes = [
41 ":message_bridge_server_fbs_includes",
42 "//aos:configuration_fbs_includes",
43 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080044 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -080045)
46
47flatbuffer_cc_library(
48 name = "message_bridge_server_fbs",
49 srcs = ["message_bridge_server.fbs"],
50 gen_reflections = 1,
51 includes = [
52 "//aos:configuration_fbs_includes",
53 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080054 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -080055)
56
Brian Silverman100534c2015-09-07 15:51:23 -040057cc_library(
Brian Silverman7a7c24d2018-09-01 17:49:09 -070058 name = "team_number",
59 srcs = [
60 "team_number.cc",
61 ],
62 hdrs = [
63 "team_number.h",
64 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080065 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman7a7c24d2018-09-01 17:49:09 -070066 deps = [
John Park33858a32018-09-28 23:05:48 -070067 "//aos/util:string_to_num",
Brian Silverman3dfbfb12020-02-17 20:35:18 -080068 "@com_github_google_glog//:glog",
Brian Silverman7a7c24d2018-09-01 17:49:09 -070069 ],
Brian Silverman100534c2015-09-07 15:51:23 -040070)
71
Austin Schuhdf5591e2015-12-19 22:36:50 -080072cc_test(
Brian Silverman7a7c24d2018-09-01 17:49:09 -070073 name = "team_number_test",
74 srcs = [
75 "team_number_test.cc",
76 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080077 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman7a7c24d2018-09-01 17:49:09 -070078 deps = [
79 ":team_number",
Jim Ostrowski8565b402020-02-29 20:26:53 -080080 "//aos:configuration",
Brian Silverman7a7c24d2018-09-01 17:49:09 -070081 "//aos/testing:googletest",
82 ],
Austin Schuhdf5591e2015-12-19 22:36:50 -080083)
Austin Schuhe84c3ed2019-12-14 15:29:48 -080084
85cc_library(
86 name = "sctp_lib",
87 srcs = [
88 "sctp_lib.cc",
89 ],
90 hdrs = [
91 "sctp_lib.h",
92 ],
93 copts = [
94 # The casts required to read datastructures from sockets trip -Wcast-align.
95 "-Wno-cast-align",
96 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080097 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -080098 deps = [
99 "//aos:unique_malloc_ptr",
Austin Schuh2fe4b712020-03-15 14:21:45 -0700100 "//aos/util:file",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800101 "//third_party/lksctp-tools:sctp",
102 "@com_github_google_glog//:glog",
103 ],
104)
105
106cc_library(
107 name = "sctp_server",
108 srcs = [
109 "sctp_server.cc",
110 ],
111 hdrs = [
112 "sctp_server.h",
113 ],
114 copts = [
115 "-Wno-cast-align",
116 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800117 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800118 deps = [
119 ":sctp_lib",
120 "//third_party/lksctp-tools:sctp",
121 ],
122)
123
124cc_library(
125 name = "message_bridge_protocol",
Austin Schuh7bc59052020-02-16 23:48:33 -0800126 srcs = [
127 "message_bridge_protocol.cc",
128 ],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800129 hdrs = [
130 "message_bridge_protocol.h",
131 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800132 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh7bc59052020-02-16 23:48:33 -0800133 deps = [
134 ":connect_fbs",
135 "//aos:configuration",
136 "//aos:flatbuffer_merge",
137 "//aos:flatbuffers",
138 "@com_github_google_flatbuffers//:flatbuffers",
139 ],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800140)
141
142cc_library(
Austin Schuhe19b6752020-08-27 23:20:19 -0700143 name = "message_bridge_server_status",
144 srcs = [
145 "message_bridge_server_status.cc",
146 ],
147 hdrs = [
148 "message_bridge_server_status.h",
149 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800150 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe19b6752020-08-27 23:20:19 -0700151 deps = [
152 ":message_bridge_client_fbs",
153 ":message_bridge_server_fbs",
154 ":timestamp_fbs",
155 ":timestamp_filter",
156 "//aos:flatbuffer_merge",
157 "//aos:flatbuffers",
158 "//aos/events:event_loop",
159 "//aos/time",
160 ],
161)
162
163cc_library(
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800164 name = "message_bridge_server_lib",
165 srcs = [
166 "message_bridge_server_lib.cc",
167 ],
168 hdrs = [
169 "message_bridge_server_lib.h",
170 ],
171 copts = [
172 "-Wno-cast-align",
173 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800174 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800175 deps = [
176 ":connect_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800177 ":message_bridge_client_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800178 ":message_bridge_protocol",
179 ":message_bridge_server_fbs",
Austin Schuhe19b6752020-08-27 23:20:19 -0700180 ":message_bridge_server_status",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800181 ":sctp_lib",
182 ":sctp_server",
Austin Schuh7bc59052020-02-16 23:48:33 -0800183 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800184 "//aos:unique_malloc_ptr",
185 "//aos/events:shm_event_loop",
186 "//aos/events/logging:logger",
187 "//third_party/lksctp-tools:sctp",
188 ],
189)
190
191cc_binary(
192 name = "message_bridge_server",
193 srcs = [
194 "message_bridge_server.cc",
195 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800196 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800197 deps = [
198 ":message_bridge_server_lib",
199 "//aos:init",
200 "//aos:json_to_flatbuffer",
201 "//aos/events:shm_event_loop",
202 ],
203)
204
205cc_library(
206 name = "sctp_client",
207 srcs = [
208 "sctp_client.cc",
209 ],
210 hdrs = [
211 "sctp_client.h",
212 ],
213 copts = [
214 "-Wno-cast-align",
215 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800216 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800217 deps = [
218 ":sctp_lib",
219 "//third_party/lksctp-tools:sctp",
220 ],
221)
222
223cc_library(
Austin Schuhae2e7bf2020-08-27 23:42:56 -0700224 name = "message_bridge_client_status",
225 srcs = [
226 "message_bridge_client_status.cc",
227 ],
228 hdrs = [
229 "message_bridge_client_status.h",
230 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800231 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhae2e7bf2020-08-27 23:42:56 -0700232 deps = [
233 ":message_bridge_client_fbs",
234 ":message_bridge_server_fbs",
235 ":timestamp_filter",
236 "//aos:flatbuffers",
237 "//aos/events:event_loop",
238 "//aos/time",
239 ],
240)
241
242cc_library(
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800243 name = "message_bridge_client_lib",
244 srcs = [
245 "message_bridge_client_lib.cc",
246 ],
247 hdrs = [
248 "message_bridge_client_lib.h",
249 ],
250 copts = [
251 "-Wno-cast-align",
252 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800253 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800254 deps = [
255 ":connect_fbs",
256 ":message_bridge_client_fbs",
Austin Schuhae2e7bf2020-08-27 23:42:56 -0700257 ":message_bridge_client_status",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800258 ":message_bridge_protocol",
259 ":message_bridge_server_fbs",
260 ":sctp_client",
Austin Schuh7bc59052020-02-16 23:48:33 -0800261 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800262 "//aos/events:shm_event_loop",
263 "//aos/events/logging:logger",
264 ],
265)
266
267cc_binary(
268 name = "message_bridge_client",
269 srcs = [
270 "message_bridge_client.cc",
271 ],
272 copts = [
273 "-Wno-cast-align",
274 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800275 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800276 deps = [
277 ":message_bridge_client_lib",
278 "//aos:init",
279 "//aos:json_to_flatbuffer",
280 "//aos/events:shm_event_loop",
281 ],
282)
283
284aos_config(
285 name = "message_bridge_test_common_config",
286 src = "message_bridge_test_common.json",
287 flatbuffers = [
Austin Schuh2f8fd752020-09-01 22:38:28 -0700288 "//aos/events/logging:logger_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800289 "//aos/events:ping_fbs",
290 "//aos/events:pong_fbs",
291 "//aos/network:message_bridge_client_fbs",
292 "//aos/network:message_bridge_server_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800293 "//aos/network:timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800294 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800295 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800296 deps = ["//aos/events:config"],
297)
298
299aos_config(
300 name = "message_bridge_test_server_config",
301 src = "message_bridge_test_server.json",
Philipp Schraderdada1072020-11-24 11:34:46 -0800302 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800303 deps = [":message_bridge_test_common_config"],
304)
305
306aos_config(
307 name = "message_bridge_test_client_config",
308 src = "message_bridge_test_client.json",
Philipp Schraderdada1072020-11-24 11:34:46 -0800309 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800310 deps = [":message_bridge_test_common_config"],
311)
312
313cc_test(
314 name = "message_bridge_test",
315 srcs = [
316 "message_bridge_test.cc",
317 ],
318 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700319 ":message_bridge_test_client_config",
320 ":message_bridge_test_server_config",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800321 ],
Austin Schuh4889b182020-11-18 19:11:56 -0800322 shard_count = 5,
Philipp Schraderdada1072020-11-24 11:34:46 -0800323 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800324 deps = [
325 ":message_bridge_client_lib",
326 ":message_bridge_server_lib",
Austin Schuh4889b182020-11-18 19:11:56 -0800327 "//aos:event",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800328 "//aos:json_to_flatbuffer",
329 "//aos/events:ping_fbs",
330 "//aos/events:pong_fbs",
331 "//aos/events:shm_event_loop",
332 "//aos/testing:googletest",
333 ],
334)
Alex Perryb3b50792020-01-18 16:13:45 -0800335
336flatbuffer_cc_library(
337 name = "web_proxy_fbs",
338 srcs = ["web_proxy.fbs"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800339 gen_reflections = True,
Alex Perry5f474f22020-02-01 12:14:24 -0800340 includes = [
341 ":connect_fbs_includes",
342 "//aos:configuration_fbs_includes",
343 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800344 target_compatible_with = ["@platforms//os:linux"],
Alex Perryb3b50792020-01-18 16:13:45 -0800345)
346
347flatbuffer_ts_library(
348 name = "web_proxy_ts_fbs",
349 srcs = ["web_proxy.fbs"],
Alex Perry5f474f22020-02-01 12:14:24 -0800350 includes = [
351 ":connect_fbs_includes",
352 "//aos:configuration_fbs_includes",
353 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800354 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -0800355)
356
357cc_library(
358 name = "web_proxy_utils",
Alex Perry5f474f22020-02-01 12:14:24 -0800359 srcs = ["web_proxy_utils.cc"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800360 hdrs = ["web_proxy_utils.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800361 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -0800362 deps = [
363 ":connect_fbs",
364 ":web_proxy_fbs",
365 "//aos:configuration_fbs",
366 "//aos/events:event_loop",
367 "@com_github_google_flatbuffers//:flatbuffers",
368 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800369)
370
371cc_library(
372 name = "web_proxy",
Alex Perryb3b50792020-01-18 16:13:45 -0800373 srcs = ["web_proxy.cc"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800374 hdrs = ["web_proxy.h"],
Alex Perryb3b50792020-01-18 16:13:45 -0800375 copts = [
376 "-DWEBRTC_POSIX",
377 "-Wno-unused-parameter",
378 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800379 target_compatible_with = ["@platforms//os:linux"],
Alex Perryb3b50792020-01-18 16:13:45 -0800380 deps = [
Alex Perry5f474f22020-02-01 12:14:24 -0800381 ":connect_fbs",
Alex Perryb3b50792020-01-18 16:13:45 -0800382 ":web_proxy_fbs",
Alex Perry5f474f22020-02-01 12:14:24 -0800383 ":web_proxy_utils",
384 "//aos/events:shm_event_loop",
Alex Perryb3b50792020-01-18 16:13:45 -0800385 "//aos/seasocks:seasocks_logger",
Alex Perryb3b50792020-01-18 16:13:45 -0800386 "//third_party:webrtc",
Austin Schuh8bd96322020-02-13 21:18:22 -0800387 "//third_party/seasocks",
Alex Perryb3b50792020-01-18 16:13:45 -0800388 "@com_github_google_glog//:glog",
389 ],
390)
391
392gen_embedded(
393 name = "gen_embedded",
394 srcs = glob(
395 include = ["www_defaults/**/*"],
396 exclude = ["www/**/*"],
397 ),
Philipp Schraderdada1072020-11-24 11:34:46 -0800398 target_compatible_with = ["@platforms//os:linux"],
Alex Perryb3b50792020-01-18 16:13:45 -0800399)
400
401cc_binary(
402 name = "web_proxy_main",
403 srcs = ["web_proxy_main.cc"],
Alex Perryb3b50792020-01-18 16:13:45 -0800404 copts = [
405 "-DWEBRTC_POSIX",
406 "-Wno-unused-parameter",
407 ],
408 data = [
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800409 "//aos/network/www:files",
Austin Schuhda9d0602019-09-15 17:29:38 -0700410 "//aos/network/www:main_bundle.min.js",
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800411 "@com_github_google_flatbuffers//:flatjs",
412 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800413 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800414 deps = [
415 ":gen_embedded",
416 ":web_proxy",
417 "//aos:init",
418 "//aos/events:shm_event_loop",
419 "//aos/seasocks:seasocks_logger",
420 "//third_party/seasocks",
421 "@com_github_google_flatbuffers//:flatbuffers",
Alex Perryb3b50792020-01-18 16:13:45 -0800422 ],
423)
Austin Schuh8bd96322020-02-13 21:18:22 -0800424
425cc_library(
426 name = "timestamp_filter",
Austin Schuh7ee6f722020-08-24 16:19:36 -0700427 srcs = ["timestamp_filter.cc"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800428 hdrs = ["timestamp_filter.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800429 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800430 deps = [
Austin Schuh04eccfc2020-08-26 21:08:27 -0700431 "//aos:configuration",
Austin Schuh8bd96322020-02-13 21:18:22 -0800432 "//aos/time",
Austin Schuhe52e23b2020-08-24 21:18:24 -0700433 "//third_party/gmp",
Austin Schuh85357ee2020-08-24 16:41:42 -0700434 "@com_google_absl//absl/strings",
Austin Schuh8bd96322020-02-13 21:18:22 -0800435 ],
436)
437
438cc_test(
439 name = "timestamp_filter_test",
440 srcs = [
441 "timestamp_filter_test.cc",
442 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800443 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800444 deps = [
445 ":timestamp_filter",
Austin Schuh04eccfc2020-08-26 21:08:27 -0700446 "//aos:json_to_flatbuffer",
Austin Schuh8bd96322020-02-13 21:18:22 -0800447 "//aos/testing:googletest",
448 ],
449)