blob: c7e5a282d7f31cfc2d510b3e54956a637c3bb51c [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 ],
14)
15
Alex Perryd5e13572020-02-22 15:15:08 -080016flatbuffer_ts_library(
17 name = "connect_ts_fbs",
18 srcs = ["connect.fbs"],
19 includes = [
20 "//aos:configuration_fbs_includes",
21 ],
22)
23
Austin Schuhe84c3ed2019-12-14 15:29:48 -080024flatbuffer_cc_library(
Austin Schuh7bc59052020-02-16 23:48:33 -080025 name = "timestamp_fbs",
26 srcs = ["timestamp.fbs"],
27 gen_reflections = 1,
28 includes = [
29 "//aos:configuration_fbs_includes",
30 ],
31)
32
33flatbuffer_cc_library(
Austin Schuhe84c3ed2019-12-14 15:29:48 -080034 name = "message_bridge_client_fbs",
35 srcs = ["message_bridge_client.fbs"],
36 gen_reflections = 1,
37 includes = [
38 ":message_bridge_server_fbs_includes",
39 "//aos:configuration_fbs_includes",
40 ],
41)
42
43flatbuffer_cc_library(
44 name = "message_bridge_server_fbs",
45 srcs = ["message_bridge_server.fbs"],
46 gen_reflections = 1,
47 includes = [
48 "//aos:configuration_fbs_includes",
49 ],
50)
51
Brian Silverman100534c2015-09-07 15:51:23 -040052cc_library(
Brian Silverman7a7c24d2018-09-01 17:49:09 -070053 name = "team_number",
54 srcs = [
55 "team_number.cc",
56 ],
57 hdrs = [
58 "team_number.h",
59 ],
Brian Silverman7a7c24d2018-09-01 17:49:09 -070060 deps = [
John Park33858a32018-09-28 23:05:48 -070061 "//aos/util:string_to_num",
Brian Silverman3dfbfb12020-02-17 20:35:18 -080062 "@com_github_google_glog//:glog",
Brian Silverman7a7c24d2018-09-01 17:49:09 -070063 ],
Brian Silverman100534c2015-09-07 15:51:23 -040064)
65
Austin Schuhdf5591e2015-12-19 22:36:50 -080066cc_test(
Brian Silverman7a7c24d2018-09-01 17:49:09 -070067 name = "team_number_test",
68 srcs = [
69 "team_number_test.cc",
70 ],
71 deps = [
72 ":team_number",
Jim Ostrowski8565b402020-02-29 20:26:53 -080073 "//aos:configuration",
Brian Silverman7a7c24d2018-09-01 17:49:09 -070074 "//aos/testing:googletest",
75 ],
Austin Schuhdf5591e2015-12-19 22:36:50 -080076)
Austin Schuhe84c3ed2019-12-14 15:29:48 -080077
78cc_library(
79 name = "sctp_lib",
80 srcs = [
81 "sctp_lib.cc",
82 ],
83 hdrs = [
84 "sctp_lib.h",
85 ],
86 copts = [
87 # The casts required to read datastructures from sockets trip -Wcast-align.
88 "-Wno-cast-align",
89 ],
90 deps = [
91 "//aos:unique_malloc_ptr",
Austin Schuh2fe4b712020-03-15 14:21:45 -070092 "//aos/util:file",
Austin Schuhe84c3ed2019-12-14 15:29:48 -080093 "//third_party/lksctp-tools:sctp",
94 "@com_github_google_glog//:glog",
95 ],
96)
97
98cc_library(
99 name = "sctp_server",
100 srcs = [
101 "sctp_server.cc",
102 ],
103 hdrs = [
104 "sctp_server.h",
105 ],
106 copts = [
107 "-Wno-cast-align",
108 ],
109 deps = [
110 ":sctp_lib",
111 "//third_party/lksctp-tools:sctp",
112 ],
113)
114
115cc_library(
116 name = "message_bridge_protocol",
Austin Schuh7bc59052020-02-16 23:48:33 -0800117 srcs = [
118 "message_bridge_protocol.cc",
119 ],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800120 hdrs = [
121 "message_bridge_protocol.h",
122 ],
Austin Schuh7bc59052020-02-16 23:48:33 -0800123 deps = [
124 ":connect_fbs",
125 "//aos:configuration",
126 "//aos:flatbuffer_merge",
127 "//aos:flatbuffers",
128 "@com_github_google_flatbuffers//:flatbuffers",
129 ],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800130)
131
132cc_library(
Austin Schuhe19b6752020-08-27 23:20:19 -0700133 name = "message_bridge_server_status",
134 srcs = [
135 "message_bridge_server_status.cc",
136 ],
137 hdrs = [
138 "message_bridge_server_status.h",
139 ],
140 deps = [
141 ":message_bridge_client_fbs",
142 ":message_bridge_server_fbs",
143 ":timestamp_fbs",
144 ":timestamp_filter",
145 "//aos:flatbuffer_merge",
146 "//aos:flatbuffers",
147 "//aos/events:event_loop",
148 "//aos/time",
149 ],
150)
151
152cc_library(
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800153 name = "message_bridge_server_lib",
154 srcs = [
155 "message_bridge_server_lib.cc",
156 ],
157 hdrs = [
158 "message_bridge_server_lib.h",
159 ],
160 copts = [
161 "-Wno-cast-align",
162 ],
163 deps = [
164 ":connect_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800165 ":message_bridge_client_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800166 ":message_bridge_protocol",
167 ":message_bridge_server_fbs",
Austin Schuhe19b6752020-08-27 23:20:19 -0700168 ":message_bridge_server_status",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800169 ":sctp_lib",
170 ":sctp_server",
Austin Schuh7bc59052020-02-16 23:48:33 -0800171 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800172 "//aos:unique_malloc_ptr",
173 "//aos/events:shm_event_loop",
174 "//aos/events/logging:logger",
175 "//third_party/lksctp-tools:sctp",
176 ],
177)
178
179cc_binary(
180 name = "message_bridge_server",
181 srcs = [
182 "message_bridge_server.cc",
183 ],
184 deps = [
185 ":message_bridge_server_lib",
186 "//aos:init",
187 "//aos:json_to_flatbuffer",
188 "//aos/events:shm_event_loop",
189 ],
190)
191
192cc_library(
193 name = "sctp_client",
194 srcs = [
195 "sctp_client.cc",
196 ],
197 hdrs = [
198 "sctp_client.h",
199 ],
200 copts = [
201 "-Wno-cast-align",
202 ],
203 deps = [
204 ":sctp_lib",
205 "//third_party/lksctp-tools:sctp",
206 ],
207)
208
209cc_library(
210 name = "message_bridge_client_lib",
211 srcs = [
212 "message_bridge_client_lib.cc",
213 ],
214 hdrs = [
215 "message_bridge_client_lib.h",
216 ],
217 copts = [
218 "-Wno-cast-align",
219 ],
220 deps = [
221 ":connect_fbs",
222 ":message_bridge_client_fbs",
223 ":message_bridge_protocol",
224 ":message_bridge_server_fbs",
225 ":sctp_client",
Austin Schuh7bc59052020-02-16 23:48:33 -0800226 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800227 "//aos/events:shm_event_loop",
228 "//aos/events/logging:logger",
229 ],
230)
231
232cc_binary(
233 name = "message_bridge_client",
234 srcs = [
235 "message_bridge_client.cc",
236 ],
237 copts = [
238 "-Wno-cast-align",
239 ],
240 deps = [
241 ":message_bridge_client_lib",
242 "//aos:init",
243 "//aos:json_to_flatbuffer",
244 "//aos/events:shm_event_loop",
245 ],
246)
247
248aos_config(
249 name = "message_bridge_test_common_config",
250 src = "message_bridge_test_common.json",
251 flatbuffers = [
252 "//aos/events:ping_fbs",
253 "//aos/events:pong_fbs",
254 "//aos/network:message_bridge_client_fbs",
255 "//aos/network:message_bridge_server_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800256 "//aos/network:timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800257 ],
258 deps = ["//aos/events:config"],
259)
260
261aos_config(
262 name = "message_bridge_test_server_config",
263 src = "message_bridge_test_server.json",
264 deps = [":message_bridge_test_common_config"],
265)
266
267aos_config(
268 name = "message_bridge_test_client_config",
269 src = "message_bridge_test_client.json",
270 deps = [":message_bridge_test_common_config"],
271)
272
273cc_test(
274 name = "message_bridge_test",
275 srcs = [
276 "message_bridge_test.cc",
277 ],
278 data = [
279 ":message_bridge_test_client_config.json",
280 ":message_bridge_test_server_config.json",
281 ],
Austin Schuh5344c352020-04-12 17:04:26 -0700282 shard_count = 3,
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800283 deps = [
284 ":message_bridge_client_lib",
285 ":message_bridge_server_lib",
286 "//aos:json_to_flatbuffer",
287 "//aos/events:ping_fbs",
288 "//aos/events:pong_fbs",
289 "//aos/events:shm_event_loop",
290 "//aos/testing:googletest",
291 ],
292)
Alex Perryb3b50792020-01-18 16:13:45 -0800293
294flatbuffer_cc_library(
295 name = "web_proxy_fbs",
296 srcs = ["web_proxy.fbs"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800297 gen_reflections = True,
Alex Perry5f474f22020-02-01 12:14:24 -0800298 includes = [
299 ":connect_fbs_includes",
300 "//aos:configuration_fbs_includes",
301 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800302)
303
304flatbuffer_ts_library(
305 name = "web_proxy_ts_fbs",
306 srcs = ["web_proxy.fbs"],
Alex Perry5f474f22020-02-01 12:14:24 -0800307 includes = [
308 ":connect_fbs_includes",
309 "//aos:configuration_fbs_includes",
310 ],
311)
312
313cc_library(
314 name = "web_proxy_utils",
Alex Perry5f474f22020-02-01 12:14:24 -0800315 srcs = ["web_proxy_utils.cc"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800316 hdrs = ["web_proxy_utils.h"],
Alex Perry5f474f22020-02-01 12:14:24 -0800317 deps = [
318 ":connect_fbs",
319 ":web_proxy_fbs",
320 "//aos:configuration_fbs",
321 "//aos/events:event_loop",
322 "@com_github_google_flatbuffers//:flatbuffers",
323 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800324)
325
326cc_library(
327 name = "web_proxy",
Alex Perryb3b50792020-01-18 16:13:45 -0800328 srcs = ["web_proxy.cc"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800329 hdrs = ["web_proxy.h"],
Alex Perryb3b50792020-01-18 16:13:45 -0800330 copts = [
331 "-DWEBRTC_POSIX",
332 "-Wno-unused-parameter",
333 ],
334 deps = [
Alex Perry5f474f22020-02-01 12:14:24 -0800335 ":connect_fbs",
Alex Perryb3b50792020-01-18 16:13:45 -0800336 ":web_proxy_fbs",
Alex Perry5f474f22020-02-01 12:14:24 -0800337 ":web_proxy_utils",
338 "//aos/events:shm_event_loop",
Alex Perryb3b50792020-01-18 16:13:45 -0800339 "//aos/seasocks:seasocks_logger",
Alex Perryb3b50792020-01-18 16:13:45 -0800340 "//third_party:webrtc",
Austin Schuh8bd96322020-02-13 21:18:22 -0800341 "//third_party/seasocks",
Alex Perryb3b50792020-01-18 16:13:45 -0800342 "@com_github_google_glog//:glog",
343 ],
344)
345
346gen_embedded(
347 name = "gen_embedded",
348 srcs = glob(
349 include = ["www_defaults/**/*"],
350 exclude = ["www/**/*"],
351 ),
352)
353
354cc_binary(
355 name = "web_proxy_main",
356 srcs = ["web_proxy_main.cc"],
Alex Perryb3b50792020-01-18 16:13:45 -0800357 copts = [
358 "-DWEBRTC_POSIX",
359 "-Wno-unused-parameter",
360 ],
361 data = [
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800362 "//aos/network/www:files",
363 "//aos/network/www:flatbuffers",
364 "//aos/network/www:main_bundle",
365 "@com_github_google_flatbuffers//:flatjs",
366 ],
367 deps = [
368 ":gen_embedded",
369 ":web_proxy",
370 "//aos:init",
371 "//aos/events:shm_event_loop",
372 "//aos/seasocks:seasocks_logger",
373 "//third_party/seasocks",
374 "@com_github_google_flatbuffers//:flatbuffers",
Alex Perryb3b50792020-01-18 16:13:45 -0800375 ],
376)
Austin Schuh8bd96322020-02-13 21:18:22 -0800377
378cc_library(
379 name = "timestamp_filter",
Austin Schuh7ee6f722020-08-24 16:19:36 -0700380 srcs = ["timestamp_filter.cc"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800381 hdrs = ["timestamp_filter.h"],
382 deps = [
Austin Schuh04eccfc2020-08-26 21:08:27 -0700383 "//aos:configuration",
Austin Schuh8bd96322020-02-13 21:18:22 -0800384 "//aos/time",
Austin Schuhe52e23b2020-08-24 21:18:24 -0700385 "//third_party/gmp",
Austin Schuh85357ee2020-08-24 16:41:42 -0700386 "@com_google_absl//absl/strings",
Austin Schuh8bd96322020-02-13 21:18:22 -0800387 ],
388)
389
390cc_test(
391 name = "timestamp_filter_test",
392 srcs = [
393 "timestamp_filter_test.cc",
394 ],
395 deps = [
396 ":timestamp_filter",
Austin Schuh04eccfc2020-08-26 21:08:27 -0700397 "//aos:json_to_flatbuffer",
Austin Schuh8bd96322020-02-13 21:18:22 -0800398 "//aos/testing:googletest",
399 ],
400)