blob: 4936da4b31af20ecfaac204c55ba9558465512b0 [file] [log] [blame]
John Park33858a32018-09-28 23:05:48 -07001load("//tools:environments.bzl", "mcu_cpus")
Alex Perryd5e13572020-02-22 15:15:08 -08002load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_py_library", "flatbuffer_ts_library")
Austin Schuh972e47e2018-12-20 17:20:58 -08003
Brian Silverman258b9172015-09-19 14:32:57 -04004filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -07005 name = "prime_binaries",
6 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -08007 "//aos:aos_dump",
Austin Schuh972e47e2018-12-20 17:20:58 -08008 "//aos:core",
John Park398c74a2018-10-20 21:17:39 -07009 "//aos/starter",
Brian Silverman6470f442018-08-05 12:08:16 -070010 ],
11 visibility = ["//visibility:public"],
Austin Schuh1eceeb92015-11-08 21:16:06 -080012)
Austin Schuhc80dd152016-02-29 01:47:44 -080013
14filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070015 name = "prime_start_binaries",
16 srcs = [
James Kuszmaul38735e82019-12-07 16:42:06 -080017 "//aos/events/logging:logger_main",
Brian Silverman6470f442018-08-05 12:08:16 -070018 ],
19 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080020)
Brian Silverman6470f442018-08-05 12:08:16 -070021
Austin Schuhc80dd152016-02-29 01:47:44 -080022filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070023 name = "prime_binaries_stripped",
24 srcs = [
25 # starter is hard coded to look for a non-stripped core...
John Park398c74a2018-10-20 21:17:39 -070026 "//aos:core",
Austin Schuh944df342019-12-21 17:08:55 -080027 "//aos:aos_dump.stripped",
John Park398c74a2018-10-20 21:17:39 -070028 "//aos/starter",
Brian Silverman6470f442018-08-05 12:08:16 -070029 ],
30 visibility = ["//visibility:public"],
31)
32
33filegroup(
34 name = "prime_start_binaries_stripped",
35 srcs = [
James Kuszmaul38735e82019-12-07 16:42:06 -080036 "//aos/events/logging:logger_main.stripped",
Brian Silverman6470f442018-08-05 12:08:16 -070037 ],
38 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080039)
Sabina Davis2ed5ea22017-09-26 22:27:42 -070040
41cc_library(
John Park33858a32018-09-28 23:05:48 -070042 name = "math",
43 hdrs = [
44 "commonmath.h",
45 ],
46 compatible_with = mcu_cpus,
47 visibility = ["//visibility:public"],
48)
49
50cc_library(
Brian Silverman6470f442018-08-05 12:08:16 -070051 name = "once",
52 srcs = [
53 "once-tmpl.h",
54 ],
55 hdrs = [
56 "once.h",
57 ],
58 visibility = ["//visibility:public"],
59 deps = [
John Park33858a32018-09-28 23:05:48 -070060 "//aos:gtest_prod",
Austin Schuh972e47e2018-12-20 17:20:58 -080061 "//aos/type_traits",
Brian Silverman6470f442018-08-05 12:08:16 -070062 ],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070063)
Brian Silverman6470f442018-08-05 12:08:16 -070064
John Park33858a32018-09-28 23:05:48 -070065cc_library(
66 name = "byteorder",
67 hdrs = [
68 "byteorder.h",
69 ],
John Park33858a32018-09-28 23:05:48 -070070 visibility = ["//visibility:public"],
71)
72
Sabina Davis2ed5ea22017-09-26 22:27:42 -070073cc_test(
Brian Silverman6470f442018-08-05 12:08:16 -070074 name = "once_test",
75 srcs = [
76 "once_test.cc",
77 ],
78 visibility = ["//visibility:public"],
79 deps = [
80 "//aos:once",
81 "//aos/testing:googletest",
82 ],
83)
84
85py_library(
86 name = "python_init",
87 srcs = ["__init__.py"],
88 visibility = ["//visibility:public"],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070089)
John Park33858a32018-09-28 23:05:48 -070090
91cc_library(
Austin Schuh972e47e2018-12-20 17:20:58 -080092 name = "macros",
93 hdrs = [
John Park33858a32018-09-28 23:05:48 -070094 "macros.h",
John Park33858a32018-09-28 23:05:48 -070095 ],
Austin Schuh972e47e2018-12-20 17:20:58 -080096 compatible_with = mcu_cpus,
John Park33858a32018-09-28 23:05:48 -070097 visibility = ["//visibility:public"],
98)
99
100cc_library(
101 name = "gtest_prod",
102 hdrs = [
103 "gtest_prod.h",
104 ],
John Park33858a32018-09-28 23:05:48 -0700105 visibility = ["//visibility:public"],
106)
107
108cc_library(
109 name = "network_port",
110 hdrs = [
111 "network_port.h",
112 ],
113 visibility = ["//visibility:public"],
114)
115
John Park33858a32018-09-28 23:05:48 -0700116cc_library(
117 name = "unique_malloc_ptr",
118 hdrs = [
119 "unique_malloc_ptr.h",
120 ],
John Park33858a32018-09-28 23:05:48 -0700121 visibility = ["//visibility:public"],
122)
123
124cc_library(
125 name = "condition",
126 srcs = [
127 "condition.cc",
128 ],
129 hdrs = [
130 "condition.h",
131 ],
John Park33858a32018-09-28 23:05:48 -0700132 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800133 deps = [
134 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800135 "//aos/mutex",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700136 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800137 ],
John Park33858a32018-09-28 23:05:48 -0700138)
139
140cc_test(
141 name = "condition_test",
142 srcs = [
143 "condition_test.cc",
144 ],
145 deps = [
146 ":condition",
147 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700148 "//aos/ipc_lib:aos_sync",
149 "//aos/ipc_lib:core_lib",
Austin Schuh972e47e2018-12-20 17:20:58 -0800150 "//aos/logging",
151 "//aos/mutex",
John Park33858a32018-09-28 23:05:48 -0700152 "//aos/testing:googletest",
153 "//aos/testing:prevent_exit",
154 "//aos/testing:test_shm",
Austin Schuh972e47e2018-12-20 17:20:58 -0800155 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700156 ],
157)
158
159cc_library(
160 name = "die",
161 srcs = [
162 "die.cc",
163 ],
164 hdrs = [
165 "die.h",
166 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800167 visibility = ["//visibility:public"],
John Park33858a32018-09-28 23:05:48 -0700168 deps = [
169 "//aos:macros",
170 "//aos/libc:aos_strerror",
171 ],
John Park33858a32018-09-28 23:05:48 -0700172)
173
John Park33858a32018-09-28 23:05:48 -0700174cc_test(
175 name = "die_test",
176 srcs = [
177 "die_test.cc",
178 ],
179 deps = [
180 ":die",
181 "//aos/testing:googletest",
182 ],
183)
184
185cc_library(
186 name = "event",
187 srcs = [
188 "event.cc",
189 ],
190 hdrs = [
191 "event.h",
192 ],
John Park33858a32018-09-28 23:05:48 -0700193 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800194 deps = [
195 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800196 "//aos/time",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700197 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800198 ],
John Park33858a32018-09-28 23:05:48 -0700199)
200
201cc_test(
202 name = "event_test",
203 srcs = [
204 "event_test.cc",
Austin Schuh972e47e2018-12-20 17:20:58 -0800205 ],
John Park33858a32018-09-28 23:05:48 -0700206 deps = [
207 ":event",
John Park33858a32018-09-28 23:05:48 -0700208 "//aos/testing:googletest",
209 "//aos/testing:test_logging",
Austin Schuh972e47e2018-12-20 17:20:58 -0800210 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700211 ],
212)
John Park398c74a2018-10-20 21:17:39 -0700213
214cc_binary(
215 name = "dump_rtprio",
216 srcs = [
217 "dump_rtprio.cc",
218 ],
219 deps = [
John Park398c74a2018-10-20 21:17:39 -0700220 "//aos/logging",
221 "//aos/logging:implementations",
Austin Schuh972e47e2018-12-20 17:20:58 -0800222 "//aos/time",
John Park398c74a2018-10-20 21:17:39 -0700223 ],
224)
225
226cc_library(
John Park398c74a2018-10-20 21:17:39 -0700227 name = "complex_thread_local",
228 srcs = [
229 "complex_thread_local.cc",
230 ],
231 hdrs = [
232 "complex_thread_local.h",
233 ],
John Park398c74a2018-10-20 21:17:39 -0700234 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800235 deps = [
236 "//aos:die",
237 "//aos:once",
238 ],
John Park398c74a2018-10-20 21:17:39 -0700239)
240
241cc_test(
242 name = "complex_thread_local_test",
243 srcs = [
244 "complex_thread_local_test.cc",
245 ],
246 deps = [
247 ":complex_thread_local",
248 "//aos/logging",
John Park398c74a2018-10-20 21:17:39 -0700249 "//aos/testing:googletest",
250 ],
251)
252
253cc_library(
254 name = "init",
255 srcs = [
256 "init.cc",
257 ],
258 hdrs = [
259 "init.h",
260 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800261 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700262 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700263 ":realtime",
John Park398c74a2018-10-20 21:17:39 -0700264 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700265 "//aos/ipc_lib:shared_mem",
Austin Schuh972e47e2018-12-20 17:20:58 -0800266 "//aos/logging:implementations",
John Park398c74a2018-10-20 21:17:39 -0700267 ],
John Park398c74a2018-10-20 21:17:39 -0700268)
269
Alex Perrycb7da4b2019-08-28 19:35:56 -0700270cc_library(
271 name = "realtime",
272 srcs = [
273 "realtime.cc",
274 ],
275 hdrs = [
276 "realtime.h",
277 ],
278 visibility = ["//visibility:public"],
279 deps = [
280 "@com_github_google_glog//:glog",
281 ],
282)
283
Austin Schuhcb108412019-10-13 16:09:54 -0700284flatbuffer_cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700285 name = "configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700286 srcs = ["configuration.fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700287 visibility = ["//visibility:public"],
Austin Schuhcb108412019-10-13 16:09:54 -0700288)
289
Alex Perryd5e13572020-02-22 15:15:08 -0800290flatbuffer_ts_library(
291 name = "configuration_ts_fbs",
292 srcs = ["configuration.fbs"],
293 visibility = ["//visibility:public"],
294)
295
Brian Silverman28760272020-02-02 13:21:51 -0800296flatbuffer_py_library(
James Kuszmaul7daef362019-12-31 18:28:17 -0800297 name = "configuration_fbs_python",
298 srcs = ["configuration.fbs"],
299 namespace = "aos",
300 tables = [
301 "Configuration",
302 "Channel",
James Kuszmaul84ff3e52020-01-03 19:48:53 -0800303 "Connection",
James Kuszmaul7daef362019-12-31 18:28:17 -0800304 "Map",
305 "Node",
306 ],
307 visibility = ["//visibility:public"],
308)
309
John Park398c74a2018-10-20 21:17:39 -0700310cc_library(
311 name = "configuration",
312 srcs = [
313 "configuration.cc",
314 ],
315 hdrs = [
316 "configuration.h",
317 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800318 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700319 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700320 ":configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700321 ":flatbuffer_merge",
322 ":flatbuffers",
323 ":json_to_flatbuffer",
John Park398c74a2018-10-20 21:17:39 -0700324 "//aos:unique_malloc_ptr",
Austin Schuh217a9782019-12-21 23:02:50 -0800325 "//aos/network:team_number",
Austin Schuhcb108412019-10-13 16:09:54 -0700326 "//aos/util:file",
327 "@com_github_google_glog//:glog",
328 "@com_google_absl//absl/container:btree",
329 "@com_google_absl//absl/strings",
John Park398c74a2018-10-20 21:17:39 -0700330 ],
John Park398c74a2018-10-20 21:17:39 -0700331)
332
333cc_binary(
334 name = "core",
335 srcs = [
336 "core.cc",
337 ],
338 deps = [
339 ":init",
340 "//aos/util:run_command",
341 ],
342)
Brian Silvermanf819b442019-01-20 16:51:04 -0800343
344cc_library(
345 name = "make_unique",
346 hdrs = [
347 "make_unique.h",
348 ],
349 visibility = ["//visibility:public"],
350)
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700351
352flatbuffer_cc_library(
353 name = "json_to_flatbuffer_flatbuffer",
354 srcs = ["json_to_flatbuffer.fbs"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800355 gen_reflections = 1,
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700356)
357
358cc_library(
Austin Schuh43c6a352019-09-30 22:22:10 -0700359 name = "flatbuffer_utils",
360 srcs = ["flatbuffer_utils.cc"],
361 hdrs = ["flatbuffer_utils.h"],
362 deps = [
363 "@com_github_google_flatbuffers//:flatbuffers",
364 ],
365)
366
367cc_library(
Austin Schuhd7e252d2019-10-06 13:51:02 -0700368 name = "json_tokenizer",
369 srcs = ["json_tokenizer.cc"],
370 hdrs = ["json_tokenizer.h"],
371 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700372 "@com_github_google_glog//:glog",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700373 "@com_google_absl//absl/strings",
374 ],
375)
376
377cc_library(
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700378 name = "json_to_flatbuffer",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800379 srcs = [
380 "flatbuffer_introspection.cc",
381 "json_to_flatbuffer.cc",
382 ],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700383 hdrs = ["json_to_flatbuffer.h"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700384 visibility = ["//visibility:public"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700385 deps = [
Austin Schuh43c6a352019-09-30 22:22:10 -0700386 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700387 ":flatbuffers",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700388 ":json_tokenizer",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700389 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuhe93d8642019-10-13 15:27:07 -0700390 "@com_github_google_glog//:glog",
Austin Schuhd339a9b2019-10-05 21:33:32 -0700391 "@com_google_absl//absl/strings",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700392 ],
393)
394
395cc_test(
396 name = "json_to_flatbuffer_test",
397 srcs = [
398 "json_to_flatbuffer_test.cc",
399 ],
400 deps = [
401 ":json_to_flatbuffer",
402 ":json_to_flatbuffer_flatbuffer",
403 "//aos/testing:googletest",
404 ],
405)
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700406
Tyler Chatow5e369a42019-11-23 11:57:31 -0800407cc_test(
408 name = "flatbuffer_introspection_test",
409 srcs = [
410 "flatbuffer_introspection_test.cc",
411 ],
412 data = [
413 ":json_to_flatbuffer_flatbuffer_reflection_out",
414 ],
415 deps = [
416 ":json_to_flatbuffer",
417 ":json_to_flatbuffer_flatbuffer",
418 "//aos/testing:googletest",
419 "//aos/util:file",
420 "@com_github_google_flatbuffers//:flatbuffers",
421 ],
422)
423
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700424cc_library(
425 name = "flatbuffer_merge",
426 srcs = ["flatbuffer_merge.cc"],
427 hdrs = ["flatbuffer_merge.h"],
428 copts = ["-Wno-cast-align"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700429 visibility = ["//visibility:public"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700430 deps = [
431 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700432 ":flatbuffers",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700433 "@com_github_google_flatbuffers//:flatbuffers",
434 ],
435)
436
437cc_test(
438 name = "flatbuffer_merge_test",
439 srcs = [
440 "flatbuffer_merge_test.cc",
441 ],
442 deps = [
443 ":flatbuffer_merge",
444 ":json_to_flatbuffer",
445 ":json_to_flatbuffer_flatbuffer",
446 "//aos/testing:googletest",
447 ],
448)
Austin Schuhe93d8642019-10-13 15:27:07 -0700449
450cc_library(
451 name = "flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700452 srcs = [
453 "flatbuffers.cc",
454 ],
Austin Schuhe93d8642019-10-13 15:27:07 -0700455 hdrs = [
456 "flatbuffers.h",
457 ],
Austin Schuh40485ed2019-10-26 21:51:44 -0700458 visibility = ["//visibility:public"],
Austin Schuhe93d8642019-10-13 15:27:07 -0700459 deps = [
James Kuszmaulad8a8082020-02-14 21:21:58 -0800460 "//aos:macros",
Austin Schuhe93d8642019-10-13 15:27:07 -0700461 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700462 "@com_github_google_glog//:glog",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700463 "@com_google_absl//absl/strings",
Austin Schuh6f3babe2020-01-26 20:34:50 -0800464 "@com_google_absl//absl/types:span",
Austin Schuhe93d8642019-10-13 15:27:07 -0700465 ],
466)
Austin Schuhcb108412019-10-13 16:09:54 -0700467
468cc_test(
469 name = "configuration_test",
470 srcs = [
471 "configuration_test.cc",
472 ],
473 data = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700474 "testdata/backwards.json",
Austin Schuhcb108412019-10-13 16:09:54 -0700475 "testdata/config1.json",
476 "testdata/config1_bad.json",
Austin Schuh8e17be92019-12-24 09:32:11 -0800477 "testdata/config1_multinode.json",
Austin Schuhcb108412019-10-13 16:09:54 -0700478 "testdata/config2.json",
Austin Schuh8e17be92019-12-24 09:32:11 -0800479 "testdata/config2_multinode.json",
Austin Schuhcb108412019-10-13 16:09:54 -0700480 "testdata/config3.json",
481 "testdata/expected.json",
Austin Schuh8e17be92019-12-24 09:32:11 -0800482 "testdata/expected_multinode.json",
Austin Schuhbca6cf02019-12-22 17:28:34 -0800483 "testdata/good_multinode.json",
Brian Silvermanaa2633f2020-02-17 21:04:14 -0800484 "testdata/good_multinode_hostnames.json",
Austin Schuh217a9782019-12-21 23:02:50 -0800485 "testdata/invalid_destination_node.json",
486 "testdata/invalid_nodes.json",
487 "testdata/invalid_source_node.json",
488 "testdata/self_forward.json",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800489 "//aos/events:pingpong_config.json",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800490 "//aos/events:pong.bfbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700491 ],
492 deps = [
493 ":configuration",
494 "//aos/testing:googletest",
495 "//aos/testing:test_logging",
496 ],
497)
Alex Perrycb7da4b2019-08-28 19:35:56 -0700498
499cc_binary(
500 name = "config_flattener",
501 srcs = [
502 "config_flattener.cc",
503 ],
504 visibility = ["//visibility:public"],
505 deps = [
506 ":configuration",
507 ":init",
508 "//aos/util:file",
509 "@com_github_google_glog//:glog",
510 ],
511)
Tyler Chatow5e369a42019-11-23 11:57:31 -0800512
513cc_binary(
Austin Schuh944df342019-12-21 17:08:55 -0800514 name = "aos_dump",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800515 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -0800516 "aos_dump.cc",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800517 ],
518 visibility = ["//visibility:public"],
519 deps = [
520 ":configuration",
521 ":json_to_flatbuffer",
522 "//aos:init",
523 "//aos/events:shm_event_loop",
524 "@com_github_google_glog//:glog",
525 ],
526)