blob: 65dac756154e4fdaf70c99b57c69641572cffb8c [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(
133 name = "message_bridge_server_lib",
134 srcs = [
135 "message_bridge_server_lib.cc",
136 ],
137 hdrs = [
138 "message_bridge_server_lib.h",
139 ],
140 copts = [
141 "-Wno-cast-align",
142 ],
143 deps = [
144 ":connect_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800145 ":message_bridge_client_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800146 ":message_bridge_protocol",
147 ":message_bridge_server_fbs",
148 ":sctp_lib",
149 ":sctp_server",
Austin Schuh7bc59052020-02-16 23:48:33 -0800150 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800151 "//aos:unique_malloc_ptr",
152 "//aos/events:shm_event_loop",
153 "//aos/events/logging:logger",
154 "//third_party/lksctp-tools:sctp",
155 ],
156)
157
158cc_binary(
159 name = "message_bridge_server",
160 srcs = [
161 "message_bridge_server.cc",
162 ],
163 deps = [
164 ":message_bridge_server_lib",
165 "//aos:init",
166 "//aos:json_to_flatbuffer",
167 "//aos/events:shm_event_loop",
168 ],
169)
170
171cc_library(
172 name = "sctp_client",
173 srcs = [
174 "sctp_client.cc",
175 ],
176 hdrs = [
177 "sctp_client.h",
178 ],
179 copts = [
180 "-Wno-cast-align",
181 ],
182 deps = [
183 ":sctp_lib",
184 "//third_party/lksctp-tools:sctp",
185 ],
186)
187
188cc_library(
189 name = "message_bridge_client_lib",
190 srcs = [
191 "message_bridge_client_lib.cc",
192 ],
193 hdrs = [
194 "message_bridge_client_lib.h",
195 ],
196 copts = [
197 "-Wno-cast-align",
198 ],
199 deps = [
200 ":connect_fbs",
201 ":message_bridge_client_fbs",
202 ":message_bridge_protocol",
203 ":message_bridge_server_fbs",
204 ":sctp_client",
Austin Schuh7bc59052020-02-16 23:48:33 -0800205 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800206 "//aos/events:shm_event_loop",
207 "//aos/events/logging:logger",
208 ],
209)
210
211cc_binary(
212 name = "message_bridge_client",
213 srcs = [
214 "message_bridge_client.cc",
215 ],
216 copts = [
217 "-Wno-cast-align",
218 ],
219 deps = [
220 ":message_bridge_client_lib",
221 "//aos:init",
222 "//aos:json_to_flatbuffer",
223 "//aos/events:shm_event_loop",
224 ],
225)
226
227aos_config(
228 name = "message_bridge_test_common_config",
229 src = "message_bridge_test_common.json",
230 flatbuffers = [
231 "//aos/events:ping_fbs",
232 "//aos/events:pong_fbs",
233 "//aos/network:message_bridge_client_fbs",
234 "//aos/network:message_bridge_server_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800235 "//aos/network:timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800236 ],
237 deps = ["//aos/events:config"],
238)
239
240aos_config(
241 name = "message_bridge_test_server_config",
242 src = "message_bridge_test_server.json",
243 deps = [":message_bridge_test_common_config"],
244)
245
246aos_config(
247 name = "message_bridge_test_client_config",
248 src = "message_bridge_test_client.json",
249 deps = [":message_bridge_test_common_config"],
250)
251
252cc_test(
253 name = "message_bridge_test",
254 srcs = [
255 "message_bridge_test.cc",
256 ],
257 data = [
258 ":message_bridge_test_client_config.json",
259 ":message_bridge_test_server_config.json",
260 ],
Austin Schuh5344c352020-04-12 17:04:26 -0700261 shard_count = 3,
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800262 deps = [
263 ":message_bridge_client_lib",
264 ":message_bridge_server_lib",
265 "//aos:json_to_flatbuffer",
266 "//aos/events:ping_fbs",
267 "//aos/events:pong_fbs",
268 "//aos/events:shm_event_loop",
269 "//aos/testing:googletest",
270 ],
271)
Alex Perryb3b50792020-01-18 16:13:45 -0800272
273flatbuffer_cc_library(
274 name = "web_proxy_fbs",
275 srcs = ["web_proxy.fbs"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800276 gen_reflections = True,
Alex Perry5f474f22020-02-01 12:14:24 -0800277 includes = [
278 ":connect_fbs_includes",
279 "//aos:configuration_fbs_includes",
280 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800281)
282
283flatbuffer_ts_library(
284 name = "web_proxy_ts_fbs",
285 srcs = ["web_proxy.fbs"],
Alex Perry5f474f22020-02-01 12:14:24 -0800286 includes = [
287 ":connect_fbs_includes",
288 "//aos:configuration_fbs_includes",
289 ],
290)
291
292cc_library(
293 name = "web_proxy_utils",
Alex Perry5f474f22020-02-01 12:14:24 -0800294 srcs = ["web_proxy_utils.cc"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800295 hdrs = ["web_proxy_utils.h"],
Alex Perry5f474f22020-02-01 12:14:24 -0800296 deps = [
297 ":connect_fbs",
298 ":web_proxy_fbs",
299 "//aos:configuration_fbs",
300 "//aos/events:event_loop",
301 "@com_github_google_flatbuffers//:flatbuffers",
302 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800303)
304
305cc_library(
306 name = "web_proxy",
Alex Perryb3b50792020-01-18 16:13:45 -0800307 srcs = ["web_proxy.cc"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800308 hdrs = ["web_proxy.h"],
Alex Perryb3b50792020-01-18 16:13:45 -0800309 copts = [
310 "-DWEBRTC_POSIX",
311 "-Wno-unused-parameter",
312 ],
313 deps = [
Alex Perry5f474f22020-02-01 12:14:24 -0800314 ":connect_fbs",
Alex Perryb3b50792020-01-18 16:13:45 -0800315 ":web_proxy_fbs",
Alex Perry5f474f22020-02-01 12:14:24 -0800316 ":web_proxy_utils",
317 "//aos/events:shm_event_loop",
Alex Perryb3b50792020-01-18 16:13:45 -0800318 "//aos/seasocks:seasocks_logger",
Alex Perryb3b50792020-01-18 16:13:45 -0800319 "//third_party:webrtc",
Austin Schuh8bd96322020-02-13 21:18:22 -0800320 "//third_party/seasocks",
Alex Perryb3b50792020-01-18 16:13:45 -0800321 "@com_github_google_glog//:glog",
322 ],
323)
324
325gen_embedded(
326 name = "gen_embedded",
327 srcs = glob(
328 include = ["www_defaults/**/*"],
329 exclude = ["www/**/*"],
330 ),
331)
332
333cc_binary(
334 name = "web_proxy_main",
335 srcs = ["web_proxy_main.cc"],
Alex Perryb3b50792020-01-18 16:13:45 -0800336 copts = [
337 "-DWEBRTC_POSIX",
338 "-Wno-unused-parameter",
339 ],
340 data = [
Alex Perry5f474f22020-02-01 12:14:24 -0800341 "//aos/events:pingpong_config.json",
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800342 "//aos/network/www:files",
343 "//aos/network/www:flatbuffers",
344 "//aos/network/www:main_bundle",
345 "@com_github_google_flatbuffers//:flatjs",
346 ],
347 deps = [
348 ":gen_embedded",
349 ":web_proxy",
350 "//aos:init",
351 "//aos/events:shm_event_loop",
352 "//aos/seasocks:seasocks_logger",
353 "//third_party/seasocks",
354 "@com_github_google_flatbuffers//:flatbuffers",
Alex Perryb3b50792020-01-18 16:13:45 -0800355 ],
356)
Austin Schuh8bd96322020-02-13 21:18:22 -0800357
358cc_library(
359 name = "timestamp_filter",
Austin Schuh7ee6f722020-08-24 16:19:36 -0700360 srcs = ["timestamp_filter.cc"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800361 hdrs = ["timestamp_filter.h"],
362 deps = [
363 "//aos/time",
364 ],
365)
366
367cc_test(
368 name = "timestamp_filter_test",
369 srcs = [
370 "timestamp_filter_test.cc",
371 ],
372 deps = [
373 ":timestamp_filter",
374 "//aos/testing:googletest",
375 ],
376)