blob: 1afbcf85e67878dd7aa1ae168de37ffa75be7309 [file] [log] [blame]
John Park33858a32018-09-28 23:05:48 -07001load("//tools:environments.bzl", "mcu_cpus")
James Kuszmaul7daef362019-12-31 18:28:17 -08002load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_python_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
James Kuszmaul7daef362019-12-31 18:28:17 -0800290flatbuffer_python_library(
291 name = "configuration_fbs_python",
292 srcs = ["configuration.fbs"],
293 namespace = "aos",
294 tables = [
295 "Configuration",
296 "Channel",
James Kuszmaul84ff3e52020-01-03 19:48:53 -0800297 "Connection",
James Kuszmaul7daef362019-12-31 18:28:17 -0800298 "Map",
299 "Node",
300 ],
301 visibility = ["//visibility:public"],
302)
303
John Park398c74a2018-10-20 21:17:39 -0700304cc_library(
305 name = "configuration",
306 srcs = [
307 "configuration.cc",
308 ],
309 hdrs = [
310 "configuration.h",
311 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800312 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700313 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700314 ":configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700315 ":flatbuffer_merge",
316 ":flatbuffers",
317 ":json_to_flatbuffer",
John Park398c74a2018-10-20 21:17:39 -0700318 "//aos:unique_malloc_ptr",
Austin Schuh217a9782019-12-21 23:02:50 -0800319 "//aos/network:team_number",
Austin Schuhcb108412019-10-13 16:09:54 -0700320 "//aos/util:file",
321 "@com_github_google_glog//:glog",
322 "@com_google_absl//absl/container:btree",
323 "@com_google_absl//absl/strings",
John Park398c74a2018-10-20 21:17:39 -0700324 ],
John Park398c74a2018-10-20 21:17:39 -0700325)
326
327cc_binary(
328 name = "core",
329 srcs = [
330 "core.cc",
331 ],
332 deps = [
333 ":init",
334 "//aos/util:run_command",
335 ],
336)
Brian Silvermanf819b442019-01-20 16:51:04 -0800337
338cc_library(
339 name = "make_unique",
340 hdrs = [
341 "make_unique.h",
342 ],
343 visibility = ["//visibility:public"],
344)
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700345
346flatbuffer_cc_library(
347 name = "json_to_flatbuffer_flatbuffer",
348 srcs = ["json_to_flatbuffer.fbs"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800349 gen_reflections = 1,
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700350)
351
352cc_library(
Austin Schuh43c6a352019-09-30 22:22:10 -0700353 name = "flatbuffer_utils",
354 srcs = ["flatbuffer_utils.cc"],
355 hdrs = ["flatbuffer_utils.h"],
356 deps = [
357 "@com_github_google_flatbuffers//:flatbuffers",
358 ],
359)
360
361cc_library(
Austin Schuhd7e252d2019-10-06 13:51:02 -0700362 name = "json_tokenizer",
363 srcs = ["json_tokenizer.cc"],
364 hdrs = ["json_tokenizer.h"],
365 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700366 "@com_github_google_glog//:glog",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700367 "@com_google_absl//absl/strings",
368 ],
369)
370
371cc_library(
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700372 name = "json_to_flatbuffer",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800373 srcs = [
374 "flatbuffer_introspection.cc",
375 "json_to_flatbuffer.cc",
376 ],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700377 hdrs = ["json_to_flatbuffer.h"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700378 visibility = ["//visibility:public"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700379 deps = [
Austin Schuh43c6a352019-09-30 22:22:10 -0700380 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700381 ":flatbuffers",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700382 ":json_tokenizer",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700383 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuhe93d8642019-10-13 15:27:07 -0700384 "@com_github_google_glog//:glog",
Austin Schuhd339a9b2019-10-05 21:33:32 -0700385 "@com_google_absl//absl/strings",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700386 ],
387)
388
389cc_test(
390 name = "json_to_flatbuffer_test",
391 srcs = [
392 "json_to_flatbuffer_test.cc",
393 ],
394 deps = [
395 ":json_to_flatbuffer",
396 ":json_to_flatbuffer_flatbuffer",
397 "//aos/testing:googletest",
398 ],
399)
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700400
Tyler Chatow5e369a42019-11-23 11:57:31 -0800401cc_test(
402 name = "flatbuffer_introspection_test",
403 srcs = [
404 "flatbuffer_introspection_test.cc",
405 ],
406 data = [
407 ":json_to_flatbuffer_flatbuffer_reflection_out",
408 ],
409 deps = [
410 ":json_to_flatbuffer",
411 ":json_to_flatbuffer_flatbuffer",
412 "//aos/testing:googletest",
413 "//aos/util:file",
414 "@com_github_google_flatbuffers//:flatbuffers",
415 ],
416)
417
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700418cc_library(
419 name = "flatbuffer_merge",
420 srcs = ["flatbuffer_merge.cc"],
421 hdrs = ["flatbuffer_merge.h"],
422 copts = ["-Wno-cast-align"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700423 visibility = ["//visibility:public"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700424 deps = [
425 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700426 ":flatbuffers",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700427 "@com_github_google_flatbuffers//:flatbuffers",
428 ],
429)
430
431cc_test(
432 name = "flatbuffer_merge_test",
433 srcs = [
434 "flatbuffer_merge_test.cc",
435 ],
436 deps = [
437 ":flatbuffer_merge",
438 ":json_to_flatbuffer",
439 ":json_to_flatbuffer_flatbuffer",
440 "//aos/testing:googletest",
441 ],
442)
Austin Schuhe93d8642019-10-13 15:27:07 -0700443
444cc_library(
445 name = "flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700446 srcs = [
447 "flatbuffers.cc",
448 ],
Austin Schuhe93d8642019-10-13 15:27:07 -0700449 hdrs = [
450 "flatbuffers.h",
451 ],
Austin Schuh40485ed2019-10-26 21:51:44 -0700452 visibility = ["//visibility:public"],
Austin Schuhe93d8642019-10-13 15:27:07 -0700453 deps = [
James Kuszmaulad8a8082020-02-14 21:21:58 -0800454 "//aos:macros",
Austin Schuhe93d8642019-10-13 15:27:07 -0700455 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700456 "@com_github_google_glog//:glog",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700457 "@com_google_absl//absl/strings",
Austin Schuh6f3babe2020-01-26 20:34:50 -0800458 "@com_google_absl//absl/types:span",
Austin Schuhe93d8642019-10-13 15:27:07 -0700459 ],
460)
Austin Schuhcb108412019-10-13 16:09:54 -0700461
462cc_test(
463 name = "configuration_test",
464 srcs = [
465 "configuration_test.cc",
466 ],
467 data = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700468 "testdata/backwards.json",
Austin Schuhcb108412019-10-13 16:09:54 -0700469 "testdata/config1.json",
470 "testdata/config1_bad.json",
Austin Schuh8e17be92019-12-24 09:32:11 -0800471 "testdata/config1_multinode.json",
Austin Schuhcb108412019-10-13 16:09:54 -0700472 "testdata/config2.json",
Austin Schuh8e17be92019-12-24 09:32:11 -0800473 "testdata/config2_multinode.json",
Austin Schuhcb108412019-10-13 16:09:54 -0700474 "testdata/config3.json",
475 "testdata/expected.json",
Austin Schuh8e17be92019-12-24 09:32:11 -0800476 "testdata/expected_multinode.json",
Austin Schuhbca6cf02019-12-22 17:28:34 -0800477 "testdata/good_multinode.json",
Austin Schuh217a9782019-12-21 23:02:50 -0800478 "testdata/invalid_destination_node.json",
479 "testdata/invalid_nodes.json",
480 "testdata/invalid_source_node.json",
481 "testdata/self_forward.json",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800482 "//aos/events:pingpong_config.json",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800483 "//aos/events:pong.bfbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700484 ],
485 deps = [
486 ":configuration",
487 "//aos/testing:googletest",
488 "//aos/testing:test_logging",
489 ],
490)
Alex Perrycb7da4b2019-08-28 19:35:56 -0700491
492cc_binary(
493 name = "config_flattener",
494 srcs = [
495 "config_flattener.cc",
496 ],
497 visibility = ["//visibility:public"],
498 deps = [
499 ":configuration",
500 ":init",
501 "//aos/util:file",
502 "@com_github_google_glog//:glog",
503 ],
504)
Tyler Chatow5e369a42019-11-23 11:57:31 -0800505
506cc_binary(
Austin Schuh944df342019-12-21 17:08:55 -0800507 name = "aos_dump",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800508 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -0800509 "aos_dump.cc",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800510 ],
511 visibility = ["//visibility:public"],
512 deps = [
513 ":configuration",
514 ":json_to_flatbuffer",
515 "//aos:init",
516 "//aos/events:shm_event_loop",
517 "@com_github_google_glog//:glog",
518 ],
519)