blob: f921a046a5a7937d1545868f4893ac1dc46f5812 [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/logging",
54 "//aos/util:string_to_num",
Austin Schuhdde64052019-12-11 20:28:00 -080055 "@com_google_absl//absl/base",
Brian Silverman7a7c24d2018-09-01 17:49:09 -070056 ],
Brian Silverman100534c2015-09-07 15:51:23 -040057)
58
Austin Schuhdf5591e2015-12-19 22:36:50 -080059cc_test(
Brian Silverman7a7c24d2018-09-01 17:49:09 -070060 name = "team_number_test",
61 srcs = [
62 "team_number_test.cc",
63 ],
64 deps = [
65 ":team_number",
66 "//aos/testing:googletest",
67 ],
Austin Schuhdf5591e2015-12-19 22:36:50 -080068)
Austin Schuhe84c3ed2019-12-14 15:29:48 -080069
70cc_library(
71 name = "sctp_lib",
72 srcs = [
73 "sctp_lib.cc",
74 ],
75 hdrs = [
76 "sctp_lib.h",
77 ],
78 copts = [
79 # The casts required to read datastructures from sockets trip -Wcast-align.
80 "-Wno-cast-align",
81 ],
82 deps = [
83 "//aos:unique_malloc_ptr",
84 "//third_party/lksctp-tools:sctp",
85 "@com_github_google_glog//:glog",
86 ],
87)
88
89cc_library(
90 name = "sctp_server",
91 srcs = [
92 "sctp_server.cc",
93 ],
94 hdrs = [
95 "sctp_server.h",
96 ],
97 copts = [
98 "-Wno-cast-align",
99 ],
100 deps = [
101 ":sctp_lib",
102 "//third_party/lksctp-tools:sctp",
103 ],
104)
105
106cc_library(
107 name = "message_bridge_protocol",
Austin Schuh7bc59052020-02-16 23:48:33 -0800108 srcs = [
109 "message_bridge_protocol.cc",
110 ],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800111 hdrs = [
112 "message_bridge_protocol.h",
113 ],
Austin Schuh7bc59052020-02-16 23:48:33 -0800114 deps = [
115 ":connect_fbs",
116 "//aos:configuration",
117 "//aos:flatbuffer_merge",
118 "//aos:flatbuffers",
119 "@com_github_google_flatbuffers//:flatbuffers",
120 ],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800121)
122
123cc_library(
124 name = "message_bridge_server_lib",
125 srcs = [
126 "message_bridge_server_lib.cc",
127 ],
128 hdrs = [
129 "message_bridge_server_lib.h",
130 ],
131 copts = [
132 "-Wno-cast-align",
133 ],
134 deps = [
135 ":connect_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800136 ":message_bridge_client_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800137 ":message_bridge_protocol",
138 ":message_bridge_server_fbs",
139 ":sctp_lib",
140 ":sctp_server",
Austin Schuh7bc59052020-02-16 23:48:33 -0800141 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800142 "//aos:unique_malloc_ptr",
143 "//aos/events:shm_event_loop",
144 "//aos/events/logging:logger",
145 "//third_party/lksctp-tools:sctp",
146 ],
147)
148
149cc_binary(
150 name = "message_bridge_server",
151 srcs = [
152 "message_bridge_server.cc",
153 ],
154 deps = [
155 ":message_bridge_server_lib",
156 "//aos:init",
157 "//aos:json_to_flatbuffer",
158 "//aos/events:shm_event_loop",
159 ],
160)
161
162cc_library(
163 name = "sctp_client",
164 srcs = [
165 "sctp_client.cc",
166 ],
167 hdrs = [
168 "sctp_client.h",
169 ],
170 copts = [
171 "-Wno-cast-align",
172 ],
173 deps = [
174 ":sctp_lib",
175 "//third_party/lksctp-tools:sctp",
176 ],
177)
178
179cc_library(
180 name = "message_bridge_client_lib",
181 srcs = [
182 "message_bridge_client_lib.cc",
183 ],
184 hdrs = [
185 "message_bridge_client_lib.h",
186 ],
187 copts = [
188 "-Wno-cast-align",
189 ],
190 deps = [
191 ":connect_fbs",
192 ":message_bridge_client_fbs",
193 ":message_bridge_protocol",
194 ":message_bridge_server_fbs",
195 ":sctp_client",
Austin Schuh7bc59052020-02-16 23:48:33 -0800196 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800197 "//aos/events:shm_event_loop",
198 "//aos/events/logging:logger",
199 ],
200)
201
202cc_binary(
203 name = "message_bridge_client",
204 srcs = [
205 "message_bridge_client.cc",
206 ],
207 copts = [
208 "-Wno-cast-align",
209 ],
210 deps = [
211 ":message_bridge_client_lib",
212 "//aos:init",
213 "//aos:json_to_flatbuffer",
214 "//aos/events:shm_event_loop",
215 ],
216)
217
218aos_config(
219 name = "message_bridge_test_common_config",
220 src = "message_bridge_test_common.json",
221 flatbuffers = [
222 "//aos/events:ping_fbs",
223 "//aos/events:pong_fbs",
224 "//aos/network:message_bridge_client_fbs",
225 "//aos/network:message_bridge_server_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800226 "//aos/network:timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800227 ],
228 deps = ["//aos/events:config"],
229)
230
231aos_config(
232 name = "message_bridge_test_server_config",
233 src = "message_bridge_test_server.json",
234 deps = [":message_bridge_test_common_config"],
235)
236
237aos_config(
238 name = "message_bridge_test_client_config",
239 src = "message_bridge_test_client.json",
240 deps = [":message_bridge_test_common_config"],
241)
242
243cc_test(
244 name = "message_bridge_test",
245 srcs = [
246 "message_bridge_test.cc",
247 ],
248 data = [
249 ":message_bridge_test_client_config.json",
250 ":message_bridge_test_server_config.json",
251 ],
252 deps = [
253 ":message_bridge_client_lib",
254 ":message_bridge_server_lib",
255 "//aos:json_to_flatbuffer",
256 "//aos/events:ping_fbs",
257 "//aos/events:pong_fbs",
258 "//aos/events:shm_event_loop",
259 "//aos/testing:googletest",
260 ],
261)
Alex Perryb3b50792020-01-18 16:13:45 -0800262
263flatbuffer_cc_library(
264 name = "web_proxy_fbs",
265 srcs = ["web_proxy.fbs"],
Austin Schuh7bc59052020-02-16 23:48:33 -0800266 gen_reflections = True,
Alex Perry5f474f22020-02-01 12:14:24 -0800267 includes = [
268 ":connect_fbs_includes",
269 "//aos:configuration_fbs_includes",
270 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800271)
272
273flatbuffer_ts_library(
274 name = "web_proxy_ts_fbs",
275 srcs = ["web_proxy.fbs"],
Alex Perry5f474f22020-02-01 12:14:24 -0800276 includes = [
277 ":connect_fbs_includes",
278 "//aos:configuration_fbs_includes",
279 ],
280)
281
282cc_library(
283 name = "web_proxy_utils",
Alex Perry5f474f22020-02-01 12:14:24 -0800284 srcs = ["web_proxy_utils.cc"],
Austin Schuh7bc59052020-02-16 23:48:33 -0800285 hdrs = ["web_proxy_utils.h"],
Alex Perry5f474f22020-02-01 12:14:24 -0800286 deps = [
287 ":connect_fbs",
288 ":web_proxy_fbs",
289 "//aos:configuration_fbs",
290 "//aos/events:event_loop",
291 "@com_github_google_flatbuffers//:flatbuffers",
292 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800293)
294
295cc_library(
296 name = "web_proxy",
Alex Perryb3b50792020-01-18 16:13:45 -0800297 srcs = ["web_proxy.cc"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800298 hdrs = ["web_proxy.h"],
Alex Perryb3b50792020-01-18 16:13:45 -0800299 copts = [
300 "-DWEBRTC_POSIX",
301 "-Wno-unused-parameter",
302 ],
303 deps = [
Alex Perry5f474f22020-02-01 12:14:24 -0800304 ":connect_fbs",
Alex Perryb3b50792020-01-18 16:13:45 -0800305 ":web_proxy_fbs",
Alex Perry5f474f22020-02-01 12:14:24 -0800306 ":web_proxy_utils",
307 "//aos/events:shm_event_loop",
Alex Perryb3b50792020-01-18 16:13:45 -0800308 "//aos/seasocks:seasocks_logger",
Alex Perryb3b50792020-01-18 16:13:45 -0800309 "//third_party:webrtc",
Austin Schuh8bd96322020-02-13 21:18:22 -0800310 "//third_party/seasocks",
Alex Perryb3b50792020-01-18 16:13:45 -0800311 "@com_github_google_glog//:glog",
312 ],
313)
314
315gen_embedded(
316 name = "gen_embedded",
317 srcs = glob(
318 include = ["www_defaults/**/*"],
319 exclude = ["www/**/*"],
320 ),
321)
322
323cc_binary(
324 name = "web_proxy_main",
325 srcs = ["web_proxy_main.cc"],
Alex Perryb3b50792020-01-18 16:13:45 -0800326 copts = [
327 "-DWEBRTC_POSIX",
328 "-Wno-unused-parameter",
329 ],
330 data = [
Alex Perry5f474f22020-02-01 12:14:24 -0800331 "//aos/events:pingpong_config.json",
Austin Schuh7bc59052020-02-16 23:48:33 -0800332 "//aos/network/www:files",
333 "//aos/network/www:flatbuffers",
334 "//aos/network/www:main_bundle",
335 "@com_github_google_flatbuffers//:flatjs",
336 ],
337 deps = [
338 ":gen_embedded",
339 ":web_proxy",
340 "//aos:init",
341 "//aos/events:shm_event_loop",
342 "//aos/seasocks:seasocks_logger",
343 "//third_party/seasocks",
344 "@com_github_google_flatbuffers//:flatbuffers",
Alex Perryb3b50792020-01-18 16:13:45 -0800345 ],
346)
Austin Schuh8bd96322020-02-13 21:18:22 -0800347
348cc_library(
349 name = "timestamp_filter",
350 hdrs = ["timestamp_filter.h"],
351 deps = [
352 "//aos/time",
353 ],
354)
355
356cc_test(
357 name = "timestamp_filter_test",
358 srcs = [
359 "timestamp_filter_test.cc",
360 ],
361 deps = [
362 ":timestamp_filter",
363 "//aos/testing:googletest",
364 ],
365)