blob: 8f3f394d5e3117bf0744bc40ce0174ddc390316a [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",
92 "//third_party/lksctp-tools:sctp",
93 "@com_github_google_glog//:glog",
94 ],
95)
96
97cc_library(
98 name = "sctp_server",
99 srcs = [
100 "sctp_server.cc",
101 ],
102 hdrs = [
103 "sctp_server.h",
104 ],
105 copts = [
106 "-Wno-cast-align",
107 ],
108 deps = [
109 ":sctp_lib",
110 "//third_party/lksctp-tools:sctp",
111 ],
112)
113
114cc_library(
115 name = "message_bridge_protocol",
Austin Schuh7bc59052020-02-16 23:48:33 -0800116 srcs = [
117 "message_bridge_protocol.cc",
118 ],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800119 hdrs = [
120 "message_bridge_protocol.h",
121 ],
Austin Schuh7bc59052020-02-16 23:48:33 -0800122 deps = [
123 ":connect_fbs",
124 "//aos:configuration",
125 "//aos:flatbuffer_merge",
126 "//aos:flatbuffers",
127 "@com_github_google_flatbuffers//:flatbuffers",
128 ],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800129)
130
131cc_library(
132 name = "message_bridge_server_lib",
133 srcs = [
134 "message_bridge_server_lib.cc",
135 ],
136 hdrs = [
137 "message_bridge_server_lib.h",
138 ],
139 copts = [
140 "-Wno-cast-align",
141 ],
142 deps = [
143 ":connect_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800144 ":message_bridge_client_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800145 ":message_bridge_protocol",
146 ":message_bridge_server_fbs",
147 ":sctp_lib",
148 ":sctp_server",
Austin Schuh7bc59052020-02-16 23:48:33 -0800149 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800150 "//aos:unique_malloc_ptr",
151 "//aos/events:shm_event_loop",
152 "//aos/events/logging:logger",
153 "//third_party/lksctp-tools:sctp",
154 ],
155)
156
157cc_binary(
158 name = "message_bridge_server",
159 srcs = [
160 "message_bridge_server.cc",
161 ],
162 deps = [
163 ":message_bridge_server_lib",
164 "//aos:init",
165 "//aos:json_to_flatbuffer",
166 "//aos/events:shm_event_loop",
167 ],
168)
169
170cc_library(
171 name = "sctp_client",
172 srcs = [
173 "sctp_client.cc",
174 ],
175 hdrs = [
176 "sctp_client.h",
177 ],
178 copts = [
179 "-Wno-cast-align",
180 ],
181 deps = [
182 ":sctp_lib",
183 "//third_party/lksctp-tools:sctp",
184 ],
185)
186
187cc_library(
188 name = "message_bridge_client_lib",
189 srcs = [
190 "message_bridge_client_lib.cc",
191 ],
192 hdrs = [
193 "message_bridge_client_lib.h",
194 ],
195 copts = [
196 "-Wno-cast-align",
197 ],
198 deps = [
199 ":connect_fbs",
200 ":message_bridge_client_fbs",
201 ":message_bridge_protocol",
202 ":message_bridge_server_fbs",
203 ":sctp_client",
Austin Schuh7bc59052020-02-16 23:48:33 -0800204 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800205 "//aos/events:shm_event_loop",
206 "//aos/events/logging:logger",
207 ],
208)
209
210cc_binary(
211 name = "message_bridge_client",
212 srcs = [
213 "message_bridge_client.cc",
214 ],
215 copts = [
216 "-Wno-cast-align",
217 ],
218 deps = [
219 ":message_bridge_client_lib",
220 "//aos:init",
221 "//aos:json_to_flatbuffer",
222 "//aos/events:shm_event_loop",
223 ],
224)
225
226aos_config(
227 name = "message_bridge_test_common_config",
228 src = "message_bridge_test_common.json",
229 flatbuffers = [
230 "//aos/events:ping_fbs",
231 "//aos/events:pong_fbs",
232 "//aos/network:message_bridge_client_fbs",
233 "//aos/network:message_bridge_server_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800234 "//aos/network:timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800235 ],
236 deps = ["//aos/events:config"],
237)
238
239aos_config(
240 name = "message_bridge_test_server_config",
241 src = "message_bridge_test_server.json",
242 deps = [":message_bridge_test_common_config"],
243)
244
245aos_config(
246 name = "message_bridge_test_client_config",
247 src = "message_bridge_test_client.json",
248 deps = [":message_bridge_test_common_config"],
249)
250
251cc_test(
252 name = "message_bridge_test",
253 srcs = [
254 "message_bridge_test.cc",
255 ],
256 data = [
257 ":message_bridge_test_client_config.json",
258 ":message_bridge_test_server_config.json",
259 ],
260 deps = [
261 ":message_bridge_client_lib",
262 ":message_bridge_server_lib",
263 "//aos:json_to_flatbuffer",
264 "//aos/events:ping_fbs",
265 "//aos/events:pong_fbs",
266 "//aos/events:shm_event_loop",
267 "//aos/testing:googletest",
268 ],
269)
Alex Perryb3b50792020-01-18 16:13:45 -0800270
271flatbuffer_cc_library(
272 name = "web_proxy_fbs",
273 srcs = ["web_proxy.fbs"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800274 gen_reflections = True,
Alex Perry5f474f22020-02-01 12:14:24 -0800275 includes = [
276 ":connect_fbs_includes",
277 "//aos:configuration_fbs_includes",
278 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800279)
280
281flatbuffer_ts_library(
282 name = "web_proxy_ts_fbs",
283 srcs = ["web_proxy.fbs"],
Alex Perry5f474f22020-02-01 12:14:24 -0800284 includes = [
285 ":connect_fbs_includes",
286 "//aos:configuration_fbs_includes",
287 ],
288)
289
290cc_library(
291 name = "web_proxy_utils",
Alex Perry5f474f22020-02-01 12:14:24 -0800292 srcs = ["web_proxy_utils.cc"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800293 hdrs = ["web_proxy_utils.h"],
Alex Perry5f474f22020-02-01 12:14:24 -0800294 deps = [
295 ":connect_fbs",
296 ":web_proxy_fbs",
297 "//aos:configuration_fbs",
298 "//aos/events:event_loop",
299 "@com_github_google_flatbuffers//:flatbuffers",
300 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800301)
302
303cc_library(
304 name = "web_proxy",
Alex Perryb3b50792020-01-18 16:13:45 -0800305 srcs = ["web_proxy.cc"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800306 hdrs = ["web_proxy.h"],
Alex Perryb3b50792020-01-18 16:13:45 -0800307 copts = [
308 "-DWEBRTC_POSIX",
309 "-Wno-unused-parameter",
310 ],
311 deps = [
Alex Perry5f474f22020-02-01 12:14:24 -0800312 ":connect_fbs",
Alex Perryb3b50792020-01-18 16:13:45 -0800313 ":web_proxy_fbs",
Alex Perry5f474f22020-02-01 12:14:24 -0800314 ":web_proxy_utils",
315 "//aos/events:shm_event_loop",
Alex Perryb3b50792020-01-18 16:13:45 -0800316 "//aos/seasocks:seasocks_logger",
Alex Perryb3b50792020-01-18 16:13:45 -0800317 "//third_party:webrtc",
Austin Schuh8bd96322020-02-13 21:18:22 -0800318 "//third_party/seasocks",
Alex Perryb3b50792020-01-18 16:13:45 -0800319 "@com_github_google_glog//:glog",
320 ],
321)
322
323gen_embedded(
324 name = "gen_embedded",
325 srcs = glob(
326 include = ["www_defaults/**/*"],
327 exclude = ["www/**/*"],
328 ),
329)
330
331cc_binary(
332 name = "web_proxy_main",
333 srcs = ["web_proxy_main.cc"],
Alex Perryb3b50792020-01-18 16:13:45 -0800334 copts = [
335 "-DWEBRTC_POSIX",
336 "-Wno-unused-parameter",
337 ],
338 data = [
Alex Perry5f474f22020-02-01 12:14:24 -0800339 "//aos/events:pingpong_config.json",
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800340 "//aos/network/www:files",
341 "//aos/network/www:flatbuffers",
342 "//aos/network/www:main_bundle",
343 "@com_github_google_flatbuffers//:flatjs",
344 ],
345 deps = [
346 ":gen_embedded",
347 ":web_proxy",
348 "//aos:init",
349 "//aos/events:shm_event_loop",
350 "//aos/seasocks:seasocks_logger",
351 "//third_party/seasocks",
352 "@com_github_google_flatbuffers//:flatbuffers",
Alex Perryb3b50792020-01-18 16:13:45 -0800353 ],
354)
Austin Schuh8bd96322020-02-13 21:18:22 -0800355
356cc_library(
357 name = "timestamp_filter",
358 hdrs = ["timestamp_filter.h"],
359 deps = [
360 "//aos/time",
361 ],
362)
363
364cc_test(
365 name = "timestamp_filter_test",
366 srcs = [
367 "timestamp_filter_test.cc",
368 ],
369 deps = [
370 ":timestamp_filter",
371 "//aos/testing:googletest",
372 ],
373)