blob: a334a47845dc6844278a9255f3d71b2819f3ac32 [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(
17 name = "message_bridge_client_fbs",
18 srcs = ["message_bridge_client.fbs"],
19 gen_reflections = 1,
20 includes = [
21 ":message_bridge_server_fbs_includes",
22 "//aos:configuration_fbs_includes",
23 ],
24)
25
26flatbuffer_cc_library(
27 name = "message_bridge_server_fbs",
28 srcs = ["message_bridge_server.fbs"],
29 gen_reflections = 1,
30 includes = [
31 "//aos:configuration_fbs_includes",
32 ],
33)
34
Brian Silverman100534c2015-09-07 15:51:23 -040035cc_library(
Brian Silverman7a7c24d2018-09-01 17:49:09 -070036 name = "team_number",
37 srcs = [
38 "team_number.cc",
39 ],
40 hdrs = [
41 "team_number.h",
42 ],
Brian Silverman7a7c24d2018-09-01 17:49:09 -070043 deps = [
John Park33858a32018-09-28 23:05:48 -070044 "//aos/logging",
45 "//aos/util:string_to_num",
Austin Schuhdde64052019-12-11 20:28:00 -080046 "@com_google_absl//absl/base",
Brian Silverman7a7c24d2018-09-01 17:49:09 -070047 ],
Brian Silverman100534c2015-09-07 15:51:23 -040048)
49
Austin Schuhdf5591e2015-12-19 22:36:50 -080050cc_test(
Brian Silverman7a7c24d2018-09-01 17:49:09 -070051 name = "team_number_test",
52 srcs = [
53 "team_number_test.cc",
54 ],
55 deps = [
56 ":team_number",
57 "//aos/testing:googletest",
58 ],
Austin Schuhdf5591e2015-12-19 22:36:50 -080059)
Austin Schuhe84c3ed2019-12-14 15:29:48 -080060
61cc_library(
62 name = "sctp_lib",
63 srcs = [
64 "sctp_lib.cc",
65 ],
66 hdrs = [
67 "sctp_lib.h",
68 ],
69 copts = [
70 # The casts required to read datastructures from sockets trip -Wcast-align.
71 "-Wno-cast-align",
72 ],
73 deps = [
74 "//aos:unique_malloc_ptr",
75 "//third_party/lksctp-tools:sctp",
76 "@com_github_google_glog//:glog",
77 ],
78)
79
80cc_library(
81 name = "sctp_server",
82 srcs = [
83 "sctp_server.cc",
84 ],
85 hdrs = [
86 "sctp_server.h",
87 ],
88 copts = [
89 "-Wno-cast-align",
90 ],
91 deps = [
92 ":sctp_lib",
93 "//third_party/lksctp-tools:sctp",
94 ],
95)
96
97cc_library(
98 name = "message_bridge_protocol",
99 hdrs = [
100 "message_bridge_protocol.h",
101 ],
102)
103
104cc_library(
105 name = "message_bridge_server_lib",
106 srcs = [
107 "message_bridge_server_lib.cc",
108 ],
109 hdrs = [
110 "message_bridge_server_lib.h",
111 ],
112 copts = [
113 "-Wno-cast-align",
114 ],
115 deps = [
116 ":connect_fbs",
117 ":message_bridge_protocol",
118 ":message_bridge_server_fbs",
119 ":sctp_lib",
120 ":sctp_server",
121 "//aos:unique_malloc_ptr",
122 "//aos/events:shm_event_loop",
123 "//aos/events/logging:logger",
124 "//third_party/lksctp-tools:sctp",
125 ],
126)
127
128cc_binary(
129 name = "message_bridge_server",
130 srcs = [
131 "message_bridge_server.cc",
132 ],
133 deps = [
134 ":message_bridge_server_lib",
135 "//aos:init",
136 "//aos:json_to_flatbuffer",
137 "//aos/events:shm_event_loop",
138 ],
139)
140
141cc_library(
142 name = "sctp_client",
143 srcs = [
144 "sctp_client.cc",
145 ],
146 hdrs = [
147 "sctp_client.h",
148 ],
149 copts = [
150 "-Wno-cast-align",
151 ],
152 deps = [
153 ":sctp_lib",
154 "//third_party/lksctp-tools:sctp",
155 ],
156)
157
158cc_library(
159 name = "message_bridge_client_lib",
160 srcs = [
161 "message_bridge_client_lib.cc",
162 ],
163 hdrs = [
164 "message_bridge_client_lib.h",
165 ],
166 copts = [
167 "-Wno-cast-align",
168 ],
169 deps = [
170 ":connect_fbs",
171 ":message_bridge_client_fbs",
172 ":message_bridge_protocol",
173 ":message_bridge_server_fbs",
174 ":sctp_client",
175 "//aos/events:shm_event_loop",
176 "//aos/events/logging:logger",
177 ],
178)
179
180cc_binary(
181 name = "message_bridge_client",
182 srcs = [
183 "message_bridge_client.cc",
184 ],
185 copts = [
186 "-Wno-cast-align",
187 ],
188 deps = [
189 ":message_bridge_client_lib",
190 "//aos:init",
191 "//aos:json_to_flatbuffer",
192 "//aos/events:shm_event_loop",
193 ],
194)
195
196aos_config(
197 name = "message_bridge_test_common_config",
198 src = "message_bridge_test_common.json",
199 flatbuffers = [
200 "//aos/events:ping_fbs",
201 "//aos/events:pong_fbs",
202 "//aos/network:message_bridge_client_fbs",
203 "//aos/network:message_bridge_server_fbs",
204 ],
205 deps = ["//aos/events:config"],
206)
207
208aos_config(
209 name = "message_bridge_test_server_config",
210 src = "message_bridge_test_server.json",
211 deps = [":message_bridge_test_common_config"],
212)
213
214aos_config(
215 name = "message_bridge_test_client_config",
216 src = "message_bridge_test_client.json",
217 deps = [":message_bridge_test_common_config"],
218)
219
220cc_test(
221 name = "message_bridge_test",
222 srcs = [
223 "message_bridge_test.cc",
224 ],
225 data = [
226 ":message_bridge_test_client_config.json",
227 ":message_bridge_test_server_config.json",
228 ],
229 deps = [
230 ":message_bridge_client_lib",
231 ":message_bridge_server_lib",
232 "//aos:json_to_flatbuffer",
233 "//aos/events:ping_fbs",
234 "//aos/events:pong_fbs",
235 "//aos/events:shm_event_loop",
236 "//aos/testing:googletest",
237 ],
238)
Alex Perryb3b50792020-01-18 16:13:45 -0800239
240flatbuffer_cc_library(
241 name = "web_proxy_fbs",
242 srcs = ["web_proxy.fbs"],
Alex Perry5f474f22020-02-01 12:14:24 -0800243 includes = [
244 ":connect_fbs_includes",
245 "//aos:configuration_fbs_includes",
246 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800247 gen_reflections = True,
248)
249
250flatbuffer_ts_library(
251 name = "web_proxy_ts_fbs",
252 srcs = ["web_proxy.fbs"],
Alex Perry5f474f22020-02-01 12:14:24 -0800253 includes = [
254 ":connect_fbs_includes",
255 "//aos:configuration_fbs_includes",
256 ],
257)
258
259cc_library(
260 name = "web_proxy_utils",
261 hdrs = ["web_proxy_utils.h"],
262 srcs = ["web_proxy_utils.cc"],
263 deps = [
264 ":connect_fbs",
265 ":web_proxy_fbs",
266 "//aos:configuration_fbs",
267 "//aos/events:event_loop",
268 "@com_github_google_flatbuffers//:flatbuffers",
269 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800270)
271
272cc_library(
273 name = "web_proxy",
274 hdrs = ["web_proxy.h"],
275 srcs = ["web_proxy.cc"],
276 copts = [
277 "-DWEBRTC_POSIX",
278 "-Wno-unused-parameter",
279 ],
280 deps = [
Alex Perry5f474f22020-02-01 12:14:24 -0800281 ":connect_fbs",
Alex Perryb3b50792020-01-18 16:13:45 -0800282 ":web_proxy_fbs",
Alex Perry5f474f22020-02-01 12:14:24 -0800283 ":web_proxy_utils",
284 "//aos/events:shm_event_loop",
Alex Perryb3b50792020-01-18 16:13:45 -0800285 "//aos/seasocks:seasocks_logger",
286 "//third_party/seasocks",
287 "//third_party:webrtc",
288 "@com_github_google_glog//:glog",
289 ],
290)
291
292gen_embedded(
293 name = "gen_embedded",
294 srcs = glob(
295 include = ["www_defaults/**/*"],
296 exclude = ["www/**/*"],
297 ),
298)
299
300cc_binary(
301 name = "web_proxy_main",
302 srcs = ["web_proxy_main.cc"],
303 deps = [
Alex Perryb3b50792020-01-18 16:13:45 -0800304 ":gen_embedded",
Alex Perry5f474f22020-02-01 12:14:24 -0800305 ":web_proxy",
306 "//aos/events:shm_event_loop",
Alex Perryb3b50792020-01-18 16:13:45 -0800307 "//aos:init",
308 "//aos/seasocks:seasocks_logger",
309 "//third_party/seasocks",
310 "@com_github_google_flatbuffers//:flatbuffers"
311 ],
312 copts = [
313 "-DWEBRTC_POSIX",
314 "-Wno-unused-parameter",
315 ],
316 data = [
317 "//aos/network/www:files",
Alex Perry5f474f22020-02-01 12:14:24 -0800318 "//aos/network/www:main_bundle",
Alex Perryb3b50792020-01-18 16:13:45 -0800319 "//aos/network/www:flatbuffers",
Alex Perry5f474f22020-02-01 12:14:24 -0800320 "@com_github_google_flatbuffers//:flatjs",
321 "//aos/events:pingpong_config.json",
Alex Perryb3b50792020-01-18 16:13:45 -0800322 ],
323)