blob: 96d561f3acda4d57126490fa161e45a4fac09efd [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
16flatbuffer_cc_library(
Austin Schuh7bc59052020-02-16 23:48:33 -080017 name = "timestamp_fbs",
18 srcs = ["timestamp.fbs"],
19 gen_reflections = 1,
20 includes = [
21 "//aos:configuration_fbs_includes",
22 ],
23)
24
25flatbuffer_cc_library(
Austin Schuhe84c3ed2019-12-14 15:29:48 -080026 name = "message_bridge_client_fbs",
27 srcs = ["message_bridge_client.fbs"],
28 gen_reflections = 1,
29 includes = [
30 ":message_bridge_server_fbs_includes",
31 "//aos:configuration_fbs_includes",
32 ],
33)
34
35flatbuffer_cc_library(
36 name = "message_bridge_server_fbs",
37 srcs = ["message_bridge_server.fbs"],
38 gen_reflections = 1,
39 includes = [
40 "//aos:configuration_fbs_includes",
41 ],
42)
43
Brian Silverman100534c2015-09-07 15:51:23 -040044cc_library(
Brian Silverman7a7c24d2018-09-01 17:49:09 -070045 name = "team_number",
46 srcs = [
47 "team_number.cc",
48 ],
49 hdrs = [
50 "team_number.h",
51 ],
Brian Silverman7a7c24d2018-09-01 17:49:09 -070052 deps = [
John Park33858a32018-09-28 23:05:48 -070053 "//aos/util:string_to_num",
Brian Silverman3dfbfb12020-02-17 20:35:18 -080054 "@com_github_google_glog//:glog",
Brian Silverman7a7c24d2018-09-01 17:49:09 -070055 ],
Brian Silverman100534c2015-09-07 15:51:23 -040056)
57
Austin Schuhdf5591e2015-12-19 22:36:50 -080058cc_test(
Brian Silverman7a7c24d2018-09-01 17:49:09 -070059 name = "team_number_test",
60 srcs = [
61 "team_number_test.cc",
62 ],
63 deps = [
64 ":team_number",
65 "//aos/testing:googletest",
66 ],
Austin Schuhdf5591e2015-12-19 22:36:50 -080067)
Austin Schuhe84c3ed2019-12-14 15:29:48 -080068
69cc_library(
70 name = "sctp_lib",
71 srcs = [
72 "sctp_lib.cc",
73 ],
74 hdrs = [
75 "sctp_lib.h",
76 ],
77 copts = [
78 # The casts required to read datastructures from sockets trip -Wcast-align.
79 "-Wno-cast-align",
80 ],
81 deps = [
82 "//aos:unique_malloc_ptr",
83 "//third_party/lksctp-tools:sctp",
84 "@com_github_google_glog//:glog",
85 ],
86)
87
88cc_library(
89 name = "sctp_server",
90 srcs = [
91 "sctp_server.cc",
92 ],
93 hdrs = [
94 "sctp_server.h",
95 ],
96 copts = [
97 "-Wno-cast-align",
98 ],
99 deps = [
100 ":sctp_lib",
101 "//third_party/lksctp-tools:sctp",
102 ],
103)
104
105cc_library(
106 name = "message_bridge_protocol",
Austin Schuh7bc59052020-02-16 23:48:33 -0800107 srcs = [
108 "message_bridge_protocol.cc",
109 ],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800110 hdrs = [
111 "message_bridge_protocol.h",
112 ],
Austin Schuh7bc59052020-02-16 23:48:33 -0800113 deps = [
114 ":connect_fbs",
115 "//aos:configuration",
116 "//aos:flatbuffer_merge",
117 "//aos:flatbuffers",
118 "@com_github_google_flatbuffers//:flatbuffers",
119 ],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800120)
121
122cc_library(
123 name = "message_bridge_server_lib",
124 srcs = [
125 "message_bridge_server_lib.cc",
126 ],
127 hdrs = [
128 "message_bridge_server_lib.h",
129 ],
130 copts = [
131 "-Wno-cast-align",
132 ],
133 deps = [
134 ":connect_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800135 ":message_bridge_client_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800136 ":message_bridge_protocol",
137 ":message_bridge_server_fbs",
138 ":sctp_lib",
139 ":sctp_server",
Austin Schuh7bc59052020-02-16 23:48:33 -0800140 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800141 "//aos:unique_malloc_ptr",
142 "//aos/events:shm_event_loop",
143 "//aos/events/logging:logger",
144 "//third_party/lksctp-tools:sctp",
145 ],
146)
147
148cc_binary(
149 name = "message_bridge_server",
150 srcs = [
151 "message_bridge_server.cc",
152 ],
153 deps = [
154 ":message_bridge_server_lib",
155 "//aos:init",
156 "//aos:json_to_flatbuffer",
157 "//aos/events:shm_event_loop",
158 ],
159)
160
161cc_library(
162 name = "sctp_client",
163 srcs = [
164 "sctp_client.cc",
165 ],
166 hdrs = [
167 "sctp_client.h",
168 ],
169 copts = [
170 "-Wno-cast-align",
171 ],
172 deps = [
173 ":sctp_lib",
174 "//third_party/lksctp-tools:sctp",
175 ],
176)
177
178cc_library(
179 name = "message_bridge_client_lib",
180 srcs = [
181 "message_bridge_client_lib.cc",
182 ],
183 hdrs = [
184 "message_bridge_client_lib.h",
185 ],
186 copts = [
187 "-Wno-cast-align",
188 ],
189 deps = [
190 ":connect_fbs",
191 ":message_bridge_client_fbs",
192 ":message_bridge_protocol",
193 ":message_bridge_server_fbs",
194 ":sctp_client",
Austin Schuh7bc59052020-02-16 23:48:33 -0800195 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800196 "//aos/events:shm_event_loop",
197 "//aos/events/logging:logger",
198 ],
199)
200
201cc_binary(
202 name = "message_bridge_client",
203 srcs = [
204 "message_bridge_client.cc",
205 ],
206 copts = [
207 "-Wno-cast-align",
208 ],
209 deps = [
210 ":message_bridge_client_lib",
211 "//aos:init",
212 "//aos:json_to_flatbuffer",
213 "//aos/events:shm_event_loop",
214 ],
215)
216
217aos_config(
218 name = "message_bridge_test_common_config",
219 src = "message_bridge_test_common.json",
220 flatbuffers = [
221 "//aos/events:ping_fbs",
222 "//aos/events:pong_fbs",
223 "//aos/network:message_bridge_client_fbs",
224 "//aos/network:message_bridge_server_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800225 "//aos/network:timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800226 ],
227 deps = ["//aos/events:config"],
228)
229
230aos_config(
231 name = "message_bridge_test_server_config",
232 src = "message_bridge_test_server.json",
233 deps = [":message_bridge_test_common_config"],
234)
235
236aos_config(
237 name = "message_bridge_test_client_config",
238 src = "message_bridge_test_client.json",
239 deps = [":message_bridge_test_common_config"],
240)
241
242cc_test(
243 name = "message_bridge_test",
244 srcs = [
245 "message_bridge_test.cc",
246 ],
247 data = [
248 ":message_bridge_test_client_config.json",
249 ":message_bridge_test_server_config.json",
250 ],
251 deps = [
252 ":message_bridge_client_lib",
253 ":message_bridge_server_lib",
254 "//aos:json_to_flatbuffer",
255 "//aos/events:ping_fbs",
256 "//aos/events:pong_fbs",
257 "//aos/events:shm_event_loop",
258 "//aos/testing:googletest",
259 ],
260)
Alex Perryb3b50792020-01-18 16:13:45 -0800261
262flatbuffer_cc_library(
263 name = "web_proxy_fbs",
264 srcs = ["web_proxy.fbs"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800265 gen_reflections = True,
Alex Perry5f474f22020-02-01 12:14:24 -0800266 includes = [
267 ":connect_fbs_includes",
268 "//aos:configuration_fbs_includes",
269 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800270)
271
272flatbuffer_ts_library(
273 name = "web_proxy_ts_fbs",
274 srcs = ["web_proxy.fbs"],
Alex Perry5f474f22020-02-01 12:14:24 -0800275 includes = [
276 ":connect_fbs_includes",
277 "//aos:configuration_fbs_includes",
278 ],
279)
280
281cc_library(
282 name = "web_proxy_utils",
Alex Perry5f474f22020-02-01 12:14:24 -0800283 srcs = ["web_proxy_utils.cc"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800284 hdrs = ["web_proxy_utils.h"],
Alex Perry5f474f22020-02-01 12:14:24 -0800285 deps = [
286 ":connect_fbs",
287 ":web_proxy_fbs",
288 "//aos:configuration_fbs",
289 "//aos/events:event_loop",
290 "@com_github_google_flatbuffers//:flatbuffers",
291 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800292)
293
294cc_library(
295 name = "web_proxy",
Alex Perryb3b50792020-01-18 16:13:45 -0800296 srcs = ["web_proxy.cc"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800297 hdrs = ["web_proxy.h"],
Alex Perryb3b50792020-01-18 16:13:45 -0800298 copts = [
299 "-DWEBRTC_POSIX",
300 "-Wno-unused-parameter",
301 ],
302 deps = [
Alex Perry5f474f22020-02-01 12:14:24 -0800303 ":connect_fbs",
Alex Perryb3b50792020-01-18 16:13:45 -0800304 ":web_proxy_fbs",
Alex Perry5f474f22020-02-01 12:14:24 -0800305 ":web_proxy_utils",
306 "//aos/events:shm_event_loop",
Alex Perryb3b50792020-01-18 16:13:45 -0800307 "//aos/seasocks:seasocks_logger",
Alex Perryb3b50792020-01-18 16:13:45 -0800308 "//third_party:webrtc",
Austin Schuh8bd96322020-02-13 21:18:22 -0800309 "//third_party/seasocks",
Alex Perryb3b50792020-01-18 16:13:45 -0800310 "@com_github_google_glog//:glog",
311 ],
312)
313
314gen_embedded(
315 name = "gen_embedded",
316 srcs = glob(
317 include = ["www_defaults/**/*"],
318 exclude = ["www/**/*"],
319 ),
320)
321
322cc_binary(
323 name = "web_proxy_main",
324 srcs = ["web_proxy_main.cc"],
Alex Perryb3b50792020-01-18 16:13:45 -0800325 copts = [
326 "-DWEBRTC_POSIX",
327 "-Wno-unused-parameter",
328 ],
329 data = [
Alex Perry5f474f22020-02-01 12:14:24 -0800330 "//aos/events:pingpong_config.json",
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800331 "//aos/network/www:files",
332 "//aos/network/www:flatbuffers",
333 "//aos/network/www:main_bundle",
334 "@com_github_google_flatbuffers//:flatjs",
335 ],
336 deps = [
337 ":gen_embedded",
338 ":web_proxy",
339 "//aos:init",
340 "//aos/events:shm_event_loop",
341 "//aos/seasocks:seasocks_logger",
342 "//third_party/seasocks",
343 "@com_github_google_flatbuffers//:flatbuffers",
Alex Perryb3b50792020-01-18 16:13:45 -0800344 ],
345)
Austin Schuh8bd96322020-02-13 21:18:22 -0800346
347cc_library(
348 name = "timestamp_filter",
349 hdrs = ["timestamp_filter.h"],
350 deps = [
351 "//aos/time",
352 ],
353)
354
355cc_test(
356 name = "timestamp_filter_test",
357 srcs = [
358 "timestamp_filter_test.cc",
359 ],
360 deps = [
361 ":timestamp_filter",
362 "//aos/testing:googletest",
363 ],
364)