blob: f9fe7ea3c29cb9145c81dd92e148017d49d032a5 [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(
Austin Schuhae2e7bf2020-08-27 23:42:56 -0700210 name = "message_bridge_client_status",
211 srcs = [
212 "message_bridge_client_status.cc",
213 ],
214 hdrs = [
215 "message_bridge_client_status.h",
216 ],
217 deps = [
218 ":message_bridge_client_fbs",
219 ":message_bridge_server_fbs",
220 ":timestamp_filter",
221 "//aos:flatbuffers",
222 "//aos/events:event_loop",
223 "//aos/time",
224 ],
225)
226
227cc_library(
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800228 name = "message_bridge_client_lib",
229 srcs = [
230 "message_bridge_client_lib.cc",
231 ],
232 hdrs = [
233 "message_bridge_client_lib.h",
234 ],
235 copts = [
236 "-Wno-cast-align",
237 ],
238 deps = [
239 ":connect_fbs",
240 ":message_bridge_client_fbs",
Austin Schuhae2e7bf2020-08-27 23:42:56 -0700241 ":message_bridge_client_status",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800242 ":message_bridge_protocol",
243 ":message_bridge_server_fbs",
244 ":sctp_client",
Austin Schuh7bc59052020-02-16 23:48:33 -0800245 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800246 "//aos/events:shm_event_loop",
247 "//aos/events/logging:logger",
248 ],
249)
250
251cc_binary(
252 name = "message_bridge_client",
253 srcs = [
254 "message_bridge_client.cc",
255 ],
256 copts = [
257 "-Wno-cast-align",
258 ],
259 deps = [
260 ":message_bridge_client_lib",
261 "//aos:init",
262 "//aos:json_to_flatbuffer",
263 "//aos/events:shm_event_loop",
264 ],
265)
266
267aos_config(
268 name = "message_bridge_test_common_config",
269 src = "message_bridge_test_common.json",
270 flatbuffers = [
271 "//aos/events:ping_fbs",
272 "//aos/events:pong_fbs",
273 "//aos/network:message_bridge_client_fbs",
274 "//aos/network:message_bridge_server_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800275 "//aos/network:timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800276 ],
277 deps = ["//aos/events:config"],
278)
279
280aos_config(
281 name = "message_bridge_test_server_config",
282 src = "message_bridge_test_server.json",
283 deps = [":message_bridge_test_common_config"],
284)
285
286aos_config(
287 name = "message_bridge_test_client_config",
288 src = "message_bridge_test_client.json",
289 deps = [":message_bridge_test_common_config"],
290)
291
292cc_test(
293 name = "message_bridge_test",
294 srcs = [
295 "message_bridge_test.cc",
296 ],
297 data = [
298 ":message_bridge_test_client_config.json",
299 ":message_bridge_test_server_config.json",
300 ],
Austin Schuh5344c352020-04-12 17:04:26 -0700301 shard_count = 3,
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800302 deps = [
303 ":message_bridge_client_lib",
304 ":message_bridge_server_lib",
305 "//aos:json_to_flatbuffer",
306 "//aos/events:ping_fbs",
307 "//aos/events:pong_fbs",
308 "//aos/events:shm_event_loop",
309 "//aos/testing:googletest",
310 ],
311)
Alex Perryb3b50792020-01-18 16:13:45 -0800312
313flatbuffer_cc_library(
314 name = "web_proxy_fbs",
315 srcs = ["web_proxy.fbs"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800316 gen_reflections = True,
Alex Perry5f474f22020-02-01 12:14:24 -0800317 includes = [
318 ":connect_fbs_includes",
319 "//aos:configuration_fbs_includes",
320 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800321)
322
323flatbuffer_ts_library(
324 name = "web_proxy_ts_fbs",
325 srcs = ["web_proxy.fbs"],
Alex Perry5f474f22020-02-01 12:14:24 -0800326 includes = [
327 ":connect_fbs_includes",
328 "//aos:configuration_fbs_includes",
329 ],
330)
331
332cc_library(
333 name = "web_proxy_utils",
Alex Perry5f474f22020-02-01 12:14:24 -0800334 srcs = ["web_proxy_utils.cc"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800335 hdrs = ["web_proxy_utils.h"],
Alex Perry5f474f22020-02-01 12:14:24 -0800336 deps = [
337 ":connect_fbs",
338 ":web_proxy_fbs",
339 "//aos:configuration_fbs",
340 "//aos/events:event_loop",
341 "@com_github_google_flatbuffers//:flatbuffers",
342 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800343)
344
345cc_library(
346 name = "web_proxy",
Alex Perryb3b50792020-01-18 16:13:45 -0800347 srcs = ["web_proxy.cc"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800348 hdrs = ["web_proxy.h"],
Alex Perryb3b50792020-01-18 16:13:45 -0800349 copts = [
350 "-DWEBRTC_POSIX",
351 "-Wno-unused-parameter",
352 ],
353 deps = [
Alex Perry5f474f22020-02-01 12:14:24 -0800354 ":connect_fbs",
Alex Perryb3b50792020-01-18 16:13:45 -0800355 ":web_proxy_fbs",
Alex Perry5f474f22020-02-01 12:14:24 -0800356 ":web_proxy_utils",
357 "//aos/events:shm_event_loop",
Alex Perryb3b50792020-01-18 16:13:45 -0800358 "//aos/seasocks:seasocks_logger",
Alex Perryb3b50792020-01-18 16:13:45 -0800359 "//third_party:webrtc",
Austin Schuh8bd96322020-02-13 21:18:22 -0800360 "//third_party/seasocks",
Alex Perryb3b50792020-01-18 16:13:45 -0800361 "@com_github_google_glog//:glog",
362 ],
363)
364
365gen_embedded(
366 name = "gen_embedded",
367 srcs = glob(
368 include = ["www_defaults/**/*"],
369 exclude = ["www/**/*"],
370 ),
371)
372
373cc_binary(
374 name = "web_proxy_main",
375 srcs = ["web_proxy_main.cc"],
Alex Perryb3b50792020-01-18 16:13:45 -0800376 copts = [
377 "-DWEBRTC_POSIX",
378 "-Wno-unused-parameter",
379 ],
380 data = [
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800381 "//aos/network/www:files",
382 "//aos/network/www:flatbuffers",
383 "//aos/network/www:main_bundle",
384 "@com_github_google_flatbuffers//:flatjs",
385 ],
386 deps = [
387 ":gen_embedded",
388 ":web_proxy",
389 "//aos:init",
390 "//aos/events:shm_event_loop",
391 "//aos/seasocks:seasocks_logger",
392 "//third_party/seasocks",
393 "@com_github_google_flatbuffers//:flatbuffers",
Alex Perryb3b50792020-01-18 16:13:45 -0800394 ],
395)
Austin Schuh8bd96322020-02-13 21:18:22 -0800396
397cc_library(
398 name = "timestamp_filter",
Austin Schuh7ee6f722020-08-24 16:19:36 -0700399 srcs = ["timestamp_filter.cc"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800400 hdrs = ["timestamp_filter.h"],
401 deps = [
Austin Schuh04eccfc2020-08-26 21:08:27 -0700402 "//aos:configuration",
Austin Schuh8bd96322020-02-13 21:18:22 -0800403 "//aos/time",
Austin Schuhe52e23b2020-08-24 21:18:24 -0700404 "//third_party/gmp",
Austin Schuh85357ee2020-08-24 16:41:42 -0700405 "@com_google_absl//absl/strings",
Austin Schuh8bd96322020-02-13 21:18:22 -0800406 ],
407)
408
409cc_test(
410 name = "timestamp_filter_test",
411 srcs = [
412 "timestamp_filter_test.cc",
413 ],
414 deps = [
415 ":timestamp_filter",
Austin Schuh04eccfc2020-08-26 21:08:27 -0700416 "//aos:json_to_flatbuffer",
Austin Schuh8bd96322020-02-13 21:18:22 -0800417 "//aos/testing:googletest",
418 ],
419)