blob: be7e5ebd7f7aed02d9718f898b3f4e48368491b5 [file] [log] [blame]
Alex Perryb3b50792020-01-18 16:13:45 -08001load("//aos/seasocks:gen_embedded.bzl", "gen_embedded")
Austin Schuhe84c3ed2019-12-14 15:29:48 -08002load("//aos:config.bzl", "aos_config")
Austin Schuh0de30f32020-12-06 12:44:28 -08003load("//aos:flatbuffers.bzl", "cc_static_flatbuffer")
4load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_ts_library")
Austin Schuhe84c3ed2019-12-14 15:29:48 -08005
Brian Silverman7a7c24d2018-09-01 17:49:09 -07006package(default_visibility = ["//visibility:public"])
Brian Silverman100534c2015-09-07 15:51:23 -04007
Austin Schuhe84c3ed2019-12-14 15:29:48 -08008flatbuffer_cc_library(
Austin Schuh0de30f32020-12-06 12:44:28 -08009 name = "remote_message_fbs",
10 srcs = ["remote_message.fbs"],
11 gen_reflections = 1,
12)
13
14cc_static_flatbuffer(
15 name = "remote_message_schema",
16 function = "aos::message_bridge::RemoteMessageSchema",
17 target = ":remote_message_fbs_reflection_out",
18)
19
20flatbuffer_cc_library(
Austin Schuhe84c3ed2019-12-14 15:29:48 -080021 name = "connect_fbs",
22 srcs = ["connect.fbs"],
23 gen_reflections = 1,
24 includes = [
25 "//aos:configuration_fbs_includes",
26 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080027 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -080028)
29
Alex Perryd5e13572020-02-22 15:15:08 -080030flatbuffer_ts_library(
31 name = "connect_ts_fbs",
32 srcs = ["connect.fbs"],
33 includes = [
34 "//aos:configuration_fbs_includes",
35 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080036 target_compatible_with = ["@platforms//os:linux"],
Alex Perryd5e13572020-02-22 15:15:08 -080037)
38
Austin Schuhe84c3ed2019-12-14 15:29:48 -080039flatbuffer_cc_library(
Austin Schuh7bc59052020-02-16 23:48:33 -080040 name = "timestamp_fbs",
41 srcs = ["timestamp.fbs"],
42 gen_reflections = 1,
43 includes = [
44 "//aos:configuration_fbs_includes",
45 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080046 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh7bc59052020-02-16 23:48:33 -080047)
48
49flatbuffer_cc_library(
Austin Schuhe84c3ed2019-12-14 15:29:48 -080050 name = "message_bridge_client_fbs",
51 srcs = ["message_bridge_client.fbs"],
52 gen_reflections = 1,
53 includes = [
54 ":message_bridge_server_fbs_includes",
55 "//aos:configuration_fbs_includes",
56 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080057 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -080058)
59
60flatbuffer_cc_library(
61 name = "message_bridge_server_fbs",
62 srcs = ["message_bridge_server.fbs"],
63 gen_reflections = 1,
64 includes = [
65 "//aos:configuration_fbs_includes",
66 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080067 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -080068)
69
Brian Silverman100534c2015-09-07 15:51:23 -040070cc_library(
Brian Silverman7a7c24d2018-09-01 17:49:09 -070071 name = "team_number",
72 srcs = [
73 "team_number.cc",
74 ],
75 hdrs = [
76 "team_number.h",
77 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080078 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman7a7c24d2018-09-01 17:49:09 -070079 deps = [
John Park33858a32018-09-28 23:05:48 -070080 "//aos/util:string_to_num",
Brian Silverman3dfbfb12020-02-17 20:35:18 -080081 "@com_github_google_glog//:glog",
Brian Silverman7a7c24d2018-09-01 17:49:09 -070082 ],
Brian Silverman100534c2015-09-07 15:51:23 -040083)
84
Austin Schuhdf5591e2015-12-19 22:36:50 -080085cc_test(
Brian Silverman7a7c24d2018-09-01 17:49:09 -070086 name = "team_number_test",
87 srcs = [
88 "team_number_test.cc",
89 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080090 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman7a7c24d2018-09-01 17:49:09 -070091 deps = [
92 ":team_number",
Jim Ostrowski8565b402020-02-29 20:26:53 -080093 "//aos:configuration",
Brian Silverman7a7c24d2018-09-01 17:49:09 -070094 "//aos/testing:googletest",
95 ],
Austin Schuhdf5591e2015-12-19 22:36:50 -080096)
Austin Schuhe84c3ed2019-12-14 15:29:48 -080097
98cc_library(
99 name = "sctp_lib",
100 srcs = [
101 "sctp_lib.cc",
102 ],
103 hdrs = [
104 "sctp_lib.h",
105 ],
106 copts = [
107 # The casts required to read datastructures from sockets trip -Wcast-align.
108 "-Wno-cast-align",
109 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800110 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800111 deps = [
112 "//aos:unique_malloc_ptr",
Austin Schuh2fe4b712020-03-15 14:21:45 -0700113 "//aos/util:file",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800114 "//third_party/lksctp-tools:sctp",
115 "@com_github_google_glog//:glog",
116 ],
117)
118
119cc_library(
120 name = "sctp_server",
121 srcs = [
122 "sctp_server.cc",
123 ],
124 hdrs = [
125 "sctp_server.h",
126 ],
127 copts = [
128 "-Wno-cast-align",
129 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800130 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800131 deps = [
132 ":sctp_lib",
133 "//third_party/lksctp-tools:sctp",
134 ],
135)
136
137cc_library(
138 name = "message_bridge_protocol",
Austin Schuh7bc59052020-02-16 23:48:33 -0800139 srcs = [
140 "message_bridge_protocol.cc",
141 ],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800142 hdrs = [
143 "message_bridge_protocol.h",
144 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800145 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh7bc59052020-02-16 23:48:33 -0800146 deps = [
147 ":connect_fbs",
148 "//aos:configuration",
149 "//aos:flatbuffer_merge",
150 "//aos:flatbuffers",
151 "@com_github_google_flatbuffers//:flatbuffers",
152 ],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800153)
154
155cc_library(
Austin Schuhe19b6752020-08-27 23:20:19 -0700156 name = "message_bridge_server_status",
157 srcs = [
158 "message_bridge_server_status.cc",
159 ],
160 hdrs = [
161 "message_bridge_server_status.h",
162 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800163 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe19b6752020-08-27 23:20:19 -0700164 deps = [
165 ":message_bridge_client_fbs",
166 ":message_bridge_server_fbs",
167 ":timestamp_fbs",
168 ":timestamp_filter",
169 "//aos:flatbuffer_merge",
170 "//aos:flatbuffers",
171 "//aos/events:event_loop",
172 "//aos/time",
173 ],
174)
175
176cc_library(
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800177 name = "message_bridge_server_lib",
178 srcs = [
179 "message_bridge_server_lib.cc",
180 ],
181 hdrs = [
182 "message_bridge_server_lib.h",
183 ],
184 copts = [
185 "-Wno-cast-align",
186 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800187 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800188 deps = [
189 ":connect_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800190 ":message_bridge_client_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800191 ":message_bridge_protocol",
192 ":message_bridge_server_fbs",
Austin Schuhe19b6752020-08-27 23:20:19 -0700193 ":message_bridge_server_status",
Austin Schuh0de30f32020-12-06 12:44:28 -0800194 ":remote_message_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800195 ":sctp_lib",
196 ":sctp_server",
Austin Schuh7bc59052020-02-16 23:48:33 -0800197 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800198 "//aos:unique_malloc_ptr",
199 "//aos/events:shm_event_loop",
200 "//aos/events/logging:logger",
201 "//third_party/lksctp-tools:sctp",
202 ],
203)
204
205cc_binary(
206 name = "message_bridge_server",
207 srcs = [
208 "message_bridge_server.cc",
209 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800210 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800211 deps = [
212 ":message_bridge_server_lib",
213 "//aos:init",
214 "//aos:json_to_flatbuffer",
215 "//aos/events:shm_event_loop",
216 ],
217)
218
219cc_library(
220 name = "sctp_client",
221 srcs = [
222 "sctp_client.cc",
223 ],
224 hdrs = [
225 "sctp_client.h",
226 ],
227 copts = [
228 "-Wno-cast-align",
229 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800230 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800231 deps = [
232 ":sctp_lib",
233 "//third_party/lksctp-tools:sctp",
234 ],
235)
236
237cc_library(
Austin Schuhae2e7bf2020-08-27 23:42:56 -0700238 name = "message_bridge_client_status",
239 srcs = [
240 "message_bridge_client_status.cc",
241 ],
242 hdrs = [
243 "message_bridge_client_status.h",
244 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800245 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhae2e7bf2020-08-27 23:42:56 -0700246 deps = [
247 ":message_bridge_client_fbs",
248 ":message_bridge_server_fbs",
249 ":timestamp_filter",
250 "//aos:flatbuffers",
251 "//aos/events:event_loop",
252 "//aos/time",
253 ],
254)
255
256cc_library(
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800257 name = "message_bridge_client_lib",
258 srcs = [
259 "message_bridge_client_lib.cc",
260 ],
261 hdrs = [
262 "message_bridge_client_lib.h",
263 ],
264 copts = [
265 "-Wno-cast-align",
266 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800267 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800268 deps = [
269 ":connect_fbs",
270 ":message_bridge_client_fbs",
Austin Schuhae2e7bf2020-08-27 23:42:56 -0700271 ":message_bridge_client_status",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800272 ":message_bridge_protocol",
273 ":message_bridge_server_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800274 ":remote_message_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800275 ":sctp_client",
Austin Schuh7bc59052020-02-16 23:48:33 -0800276 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800277 "//aos/events:shm_event_loop",
278 "//aos/events/logging:logger",
279 ],
280)
281
282cc_binary(
283 name = "message_bridge_client",
284 srcs = [
285 "message_bridge_client.cc",
286 ],
287 copts = [
288 "-Wno-cast-align",
289 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800290 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800291 deps = [
292 ":message_bridge_client_lib",
293 "//aos:init",
294 "//aos:json_to_flatbuffer",
295 "//aos/events:shm_event_loop",
296 ],
297)
298
299aos_config(
300 name = "message_bridge_test_common_config",
301 src = "message_bridge_test_common.json",
302 flatbuffers = [
Austin Schuh0de30f32020-12-06 12:44:28 -0800303 ":remote_message_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800304 "//aos/events:ping_fbs",
305 "//aos/events:pong_fbs",
306 "//aos/network:message_bridge_client_fbs",
307 "//aos/network:message_bridge_server_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800308 "//aos/network:timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800309 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800310 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800311 deps = ["//aos/events:config"],
312)
313
314aos_config(
315 name = "message_bridge_test_server_config",
316 src = "message_bridge_test_server.json",
Philipp Schraderdada1072020-11-24 11:34:46 -0800317 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800318 deps = [":message_bridge_test_common_config"],
319)
320
321aos_config(
322 name = "message_bridge_test_client_config",
323 src = "message_bridge_test_client.json",
Philipp Schraderdada1072020-11-24 11:34:46 -0800324 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800325 deps = [":message_bridge_test_common_config"],
326)
327
328cc_test(
329 name = "message_bridge_test",
330 srcs = [
331 "message_bridge_test.cc",
332 ],
333 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700334 ":message_bridge_test_client_config",
335 ":message_bridge_test_server_config",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800336 ],
Austin Schuh4889b182020-11-18 19:11:56 -0800337 shard_count = 5,
Philipp Schraderdada1072020-11-24 11:34:46 -0800338 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800339 deps = [
340 ":message_bridge_client_lib",
341 ":message_bridge_server_lib",
Austin Schuh4889b182020-11-18 19:11:56 -0800342 "//aos:event",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800343 "//aos:json_to_flatbuffer",
344 "//aos/events:ping_fbs",
345 "//aos/events:pong_fbs",
346 "//aos/events:shm_event_loop",
347 "//aos/testing:googletest",
348 ],
349)
Alex Perryb3b50792020-01-18 16:13:45 -0800350
351flatbuffer_cc_library(
352 name = "web_proxy_fbs",
353 srcs = ["web_proxy.fbs"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800354 gen_reflections = True,
Alex Perry5f474f22020-02-01 12:14:24 -0800355 includes = [
356 ":connect_fbs_includes",
357 "//aos:configuration_fbs_includes",
358 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800359 target_compatible_with = ["@platforms//os:linux"],
Alex Perryb3b50792020-01-18 16:13:45 -0800360)
361
362flatbuffer_ts_library(
363 name = "web_proxy_ts_fbs",
364 srcs = ["web_proxy.fbs"],
Alex Perry5f474f22020-02-01 12:14:24 -0800365 includes = [
366 ":connect_fbs_includes",
367 "//aos:configuration_fbs_includes",
368 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800369 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -0800370)
371
372cc_library(
373 name = "web_proxy_utils",
Alex Perry5f474f22020-02-01 12:14:24 -0800374 srcs = ["web_proxy_utils.cc"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800375 hdrs = ["web_proxy_utils.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800376 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -0800377 deps = [
378 ":connect_fbs",
379 ":web_proxy_fbs",
380 "//aos:configuration_fbs",
381 "//aos/events:event_loop",
382 "@com_github_google_flatbuffers//:flatbuffers",
383 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800384)
385
386cc_library(
387 name = "web_proxy",
Alex Perryb3b50792020-01-18 16:13:45 -0800388 srcs = ["web_proxy.cc"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800389 hdrs = ["web_proxy.h"],
Alex Perryb3b50792020-01-18 16:13:45 -0800390 copts = [
391 "-DWEBRTC_POSIX",
392 "-Wno-unused-parameter",
393 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800394 target_compatible_with = ["@platforms//os:linux"],
Alex Perryb3b50792020-01-18 16:13:45 -0800395 deps = [
Alex Perry5f474f22020-02-01 12:14:24 -0800396 ":connect_fbs",
Alex Perryb3b50792020-01-18 16:13:45 -0800397 ":web_proxy_fbs",
Alex Perry5f474f22020-02-01 12:14:24 -0800398 ":web_proxy_utils",
399 "//aos/events:shm_event_loop",
Alex Perryb3b50792020-01-18 16:13:45 -0800400 "//aos/seasocks:seasocks_logger",
Alex Perryb3b50792020-01-18 16:13:45 -0800401 "//third_party:webrtc",
Austin Schuh8bd96322020-02-13 21:18:22 -0800402 "//third_party/seasocks",
Alex Perryb3b50792020-01-18 16:13:45 -0800403 "@com_github_google_glog//:glog",
404 ],
405)
406
407gen_embedded(
408 name = "gen_embedded",
409 srcs = glob(
410 include = ["www_defaults/**/*"],
411 exclude = ["www/**/*"],
412 ),
Philipp Schraderdada1072020-11-24 11:34:46 -0800413 target_compatible_with = ["@platforms//os:linux"],
Alex Perryb3b50792020-01-18 16:13:45 -0800414)
415
416cc_binary(
417 name = "web_proxy_main",
418 srcs = ["web_proxy_main.cc"],
Alex Perryb3b50792020-01-18 16:13:45 -0800419 copts = [
420 "-DWEBRTC_POSIX",
421 "-Wno-unused-parameter",
422 ],
423 data = [
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800424 "//aos/network/www:files",
Austin Schuhda9d0602019-09-15 17:29:38 -0700425 "//aos/network/www:main_bundle.min.js",
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800426 "@com_github_google_flatbuffers//:flatjs",
427 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800428 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800429 deps = [
430 ":gen_embedded",
431 ":web_proxy",
432 "//aos:init",
433 "//aos/events:shm_event_loop",
434 "//aos/seasocks:seasocks_logger",
435 "//third_party/seasocks",
436 "@com_github_google_flatbuffers//:flatbuffers",
Alex Perryb3b50792020-01-18 16:13:45 -0800437 ],
438)
Austin Schuh8bd96322020-02-13 21:18:22 -0800439
James Kuszmaul71a81932020-12-15 21:08:01 -0800440cc_binary(
441 name = "log_web_proxy_main",
442 srcs = ["log_web_proxy_main.cc"],
443 args = [
James Kuszmaul71a81932020-12-15 21:08:01 -0800444 "--data_dir=aos/network/www",
445 ],
446 copts = [
447 "-DWEBRTC_POSIX",
448 "-Wno-unused-parameter",
449 ],
James Kuszmaul71a81932020-12-15 21:08:01 -0800450 deps = [
451 ":gen_embedded",
452 ":web_proxy",
453 "//aos:init",
454 "//aos/events:simulated_event_loop",
455 "//aos/events/logging:logger",
456 "//aos/seasocks:seasocks_logger",
457 "//third_party/seasocks",
458 "@com_github_google_flatbuffers//:flatbuffers",
459 ],
460)
461
Austin Schuh8bd96322020-02-13 21:18:22 -0800462cc_library(
463 name = "timestamp_filter",
Austin Schuh7ee6f722020-08-24 16:19:36 -0700464 srcs = ["timestamp_filter.cc"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800465 hdrs = ["timestamp_filter.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800466 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800467 deps = [
Austin Schuh04eccfc2020-08-26 21:08:27 -0700468 "//aos:configuration",
Austin Schuh8bd96322020-02-13 21:18:22 -0800469 "//aos/time",
Austin Schuhe52e23b2020-08-24 21:18:24 -0700470 "//third_party/gmp",
Austin Schuh85357ee2020-08-24 16:41:42 -0700471 "@com_google_absl//absl/strings",
Austin Schuh8bd96322020-02-13 21:18:22 -0800472 ],
473)
474
Austin Schuh0ca1fd32020-12-18 22:53:05 -0800475cc_library(
476 name = "multinode_timestamp_filter",
477 srcs = ["multinode_timestamp_filter.cc"],
478 hdrs = ["multinode_timestamp_filter.h"],
479 target_compatible_with = ["@platforms//os:linux"],
480 deps = [
481 ":timestamp_filter",
482 "//aos:configuration",
483 "//aos/events:simulated_event_loop",
484 "//aos/time",
485 "//third_party/gmp",
486 "@org_tuxfamily_eigen//:eigen",
487 ],
488)
489
Austin Schuh8bd96322020-02-13 21:18:22 -0800490cc_test(
491 name = "timestamp_filter_test",
492 srcs = [
493 "timestamp_filter_test.cc",
494 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800495 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800496 deps = [
497 ":timestamp_filter",
Austin Schuh04eccfc2020-08-26 21:08:27 -0700498 "//aos:json_to_flatbuffer",
Austin Schuh8bd96322020-02-13 21:18:22 -0800499 "//aos/testing:googletest",
500 ],
501)