blob: 9962ceabf09c457386575fc85a3a73dc66324559 [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",
John Park398c74a2018-10-20 21:17:39 -07008 "//aos/starter",
Brian Silverman6470f442018-08-05 12:08:16 -07009 ],
10 visibility = ["//visibility:public"],
Austin Schuh1eceeb92015-11-08 21:16:06 -080011)
Austin Schuhc80dd152016-02-29 01:47:44 -080012
13filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070014 name = "prime_start_binaries",
15 srcs = [
James Kuszmaul38735e82019-12-07 16:42:06 -080016 "//aos/events/logging:logger_main",
Brian Silverman6470f442018-08-05 12:08:16 -070017 ],
18 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080019)
Brian Silverman6470f442018-08-05 12:08:16 -070020
Austin Schuhc80dd152016-02-29 01:47:44 -080021filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070022 name = "prime_binaries_stripped",
23 srcs = [
24 # starter is hard coded to look for a non-stripped core...
Austin Schuh944df342019-12-21 17:08:55 -080025 "//aos:aos_dump.stripped",
John Park398c74a2018-10-20 21:17:39 -070026 "//aos/starter",
Brian Silverman6470f442018-08-05 12:08:16 -070027 ],
28 visibility = ["//visibility:public"],
29)
30
31filegroup(
32 name = "prime_start_binaries_stripped",
33 srcs = [
James Kuszmaul38735e82019-12-07 16:42:06 -080034 "//aos/events/logging:logger_main.stripped",
Brian Silverman6470f442018-08-05 12:08:16 -070035 ],
36 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080037)
Sabina Davis2ed5ea22017-09-26 22:27:42 -070038
39cc_library(
John Park33858a32018-09-28 23:05:48 -070040 name = "math",
41 hdrs = [
42 "commonmath.h",
43 ],
44 compatible_with = mcu_cpus,
45 visibility = ["//visibility:public"],
46)
47
48cc_library(
Brian Silverman6470f442018-08-05 12:08:16 -070049 name = "once",
50 srcs = [
51 "once-tmpl.h",
52 ],
53 hdrs = [
54 "once.h",
55 ],
56 visibility = ["//visibility:public"],
57 deps = [
John Park33858a32018-09-28 23:05:48 -070058 "//aos:gtest_prod",
Austin Schuh972e47e2018-12-20 17:20:58 -080059 "//aos/type_traits",
Brian Silverman6470f442018-08-05 12:08:16 -070060 ],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070061)
Brian Silverman6470f442018-08-05 12:08:16 -070062
John Park33858a32018-09-28 23:05:48 -070063cc_library(
64 name = "byteorder",
65 hdrs = [
66 "byteorder.h",
67 ],
John Park33858a32018-09-28 23:05:48 -070068 visibility = ["//visibility:public"],
69)
70
Sabina Davis2ed5ea22017-09-26 22:27:42 -070071cc_test(
Brian Silverman6470f442018-08-05 12:08:16 -070072 name = "once_test",
73 srcs = [
74 "once_test.cc",
75 ],
76 visibility = ["//visibility:public"],
77 deps = [
78 "//aos:once",
79 "//aos/testing:googletest",
80 ],
81)
82
83py_library(
84 name = "python_init",
85 srcs = ["__init__.py"],
86 visibility = ["//visibility:public"],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070087)
John Park33858a32018-09-28 23:05:48 -070088
89cc_library(
Austin Schuh972e47e2018-12-20 17:20:58 -080090 name = "macros",
91 hdrs = [
John Park33858a32018-09-28 23:05:48 -070092 "macros.h",
John Park33858a32018-09-28 23:05:48 -070093 ],
Austin Schuh972e47e2018-12-20 17:20:58 -080094 compatible_with = mcu_cpus,
John Park33858a32018-09-28 23:05:48 -070095 visibility = ["//visibility:public"],
96)
97
98cc_library(
99 name = "gtest_prod",
100 hdrs = [
101 "gtest_prod.h",
102 ],
John Park33858a32018-09-28 23:05:48 -0700103 visibility = ["//visibility:public"],
104)
105
106cc_library(
107 name = "network_port",
108 hdrs = [
109 "network_port.h",
110 ],
111 visibility = ["//visibility:public"],
112)
113
John Park33858a32018-09-28 23:05:48 -0700114cc_library(
115 name = "unique_malloc_ptr",
116 hdrs = [
117 "unique_malloc_ptr.h",
118 ],
John Park33858a32018-09-28 23:05:48 -0700119 visibility = ["//visibility:public"],
120)
121
122cc_library(
123 name = "condition",
124 srcs = [
125 "condition.cc",
126 ],
127 hdrs = [
128 "condition.h",
129 ],
John Park33858a32018-09-28 23:05:48 -0700130 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800131 deps = [
132 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800133 "//aos/mutex",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700134 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800135 ],
John Park33858a32018-09-28 23:05:48 -0700136)
137
138cc_test(
139 name = "condition_test",
140 srcs = [
141 "condition_test.cc",
142 ],
143 deps = [
144 ":condition",
145 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700146 "//aos/ipc_lib:aos_sync",
147 "//aos/ipc_lib:core_lib",
Austin Schuh972e47e2018-12-20 17:20:58 -0800148 "//aos/logging",
149 "//aos/mutex",
John Park33858a32018-09-28 23:05:48 -0700150 "//aos/testing:googletest",
151 "//aos/testing:prevent_exit",
152 "//aos/testing:test_shm",
Austin Schuh972e47e2018-12-20 17:20:58 -0800153 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700154 ],
155)
156
157cc_library(
158 name = "die",
159 srcs = [
160 "die.cc",
161 ],
162 hdrs = [
163 "die.h",
164 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800165 visibility = ["//visibility:public"],
John Park33858a32018-09-28 23:05:48 -0700166 deps = [
167 "//aos:macros",
168 "//aos/libc:aos_strerror",
169 ],
John Park33858a32018-09-28 23:05:48 -0700170)
171
John Park33858a32018-09-28 23:05:48 -0700172cc_test(
173 name = "die_test",
174 srcs = [
175 "die_test.cc",
176 ],
177 deps = [
178 ":die",
179 "//aos/testing:googletest",
180 ],
181)
182
183cc_library(
184 name = "event",
185 srcs = [
186 "event.cc",
187 ],
188 hdrs = [
189 "event.h",
190 ],
John Park33858a32018-09-28 23:05:48 -0700191 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800192 deps = [
193 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800194 "//aos/time",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700195 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800196 ],
John Park33858a32018-09-28 23:05:48 -0700197)
198
199cc_test(
200 name = "event_test",
201 srcs = [
202 "event_test.cc",
Austin Schuh972e47e2018-12-20 17:20:58 -0800203 ],
John Park33858a32018-09-28 23:05:48 -0700204 deps = [
205 ":event",
John Park33858a32018-09-28 23:05:48 -0700206 "//aos/testing:googletest",
207 "//aos/testing:test_logging",
Austin Schuh972e47e2018-12-20 17:20:58 -0800208 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700209 ],
210)
John Park398c74a2018-10-20 21:17:39 -0700211
212cc_binary(
213 name = "dump_rtprio",
214 srcs = [
215 "dump_rtprio.cc",
216 ],
217 deps = [
John Park398c74a2018-10-20 21:17:39 -0700218 "//aos/logging",
219 "//aos/logging:implementations",
Austin Schuh972e47e2018-12-20 17:20:58 -0800220 "//aos/time",
John Park398c74a2018-10-20 21:17:39 -0700221 ],
222)
223
224cc_library(
John Park398c74a2018-10-20 21:17:39 -0700225 name = "complex_thread_local",
226 srcs = [
227 "complex_thread_local.cc",
228 ],
229 hdrs = [
230 "complex_thread_local.h",
231 ],
John Park398c74a2018-10-20 21:17:39 -0700232 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800233 deps = [
234 "//aos:die",
John Park65170ac2020-01-08 20:15:24 -0800235 "@com_google_absl//absl/base",
Austin Schuh972e47e2018-12-20 17:20:58 -0800236 ],
John Park398c74a2018-10-20 21:17:39 -0700237)
238
239cc_test(
240 name = "complex_thread_local_test",
241 srcs = [
242 "complex_thread_local_test.cc",
243 ],
244 deps = [
245 ":complex_thread_local",
246 "//aos/logging",
John Park398c74a2018-10-20 21:17:39 -0700247 "//aos/testing:googletest",
248 ],
249)
250
251cc_library(
252 name = "init",
253 srcs = [
254 "init.cc",
255 ],
256 hdrs = [
257 "init.h",
258 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800259 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700260 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700261 ":realtime",
John Park398c74a2018-10-20 21:17:39 -0700262 "//aos:die",
Austin Schuh972e47e2018-12-20 17:20:58 -0800263 "//aos/logging:implementations",
John Park398c74a2018-10-20 21:17:39 -0700264 ],
John Park398c74a2018-10-20 21:17:39 -0700265)
266
Alex Perrycb7da4b2019-08-28 19:35:56 -0700267cc_library(
268 name = "realtime",
269 srcs = [
270 "realtime.cc",
271 ],
272 hdrs = [
273 "realtime.h",
274 ],
275 visibility = ["//visibility:public"],
276 deps = [
Austin Schuhcc6070c2020-10-10 20:25:56 -0700277 ":thread_local",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700278 "@com_github_google_glog//:glog",
279 ],
280)
281
Austin Schuhcb108412019-10-13 16:09:54 -0700282flatbuffer_cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700283 name = "configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700284 srcs = ["configuration.fbs"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700285 gen_reflections = 1,
Alex Perrycb7da4b2019-08-28 19:35:56 -0700286 visibility = ["//visibility:public"],
Austin Schuhcb108412019-10-13 16:09:54 -0700287)
288
Alex Perryd5e13572020-02-22 15:15:08 -0800289flatbuffer_ts_library(
290 name = "configuration_ts_fbs",
291 srcs = ["configuration.fbs"],
292 visibility = ["//visibility:public"],
293)
294
Brian Silverman28760272020-02-02 13:21:51 -0800295flatbuffer_py_library(
James Kuszmaul7daef362019-12-31 18:28:17 -0800296 name = "configuration_fbs_python",
297 srcs = ["configuration.fbs"],
298 namespace = "aos",
299 tables = [
300 "Configuration",
301 "Channel",
James Kuszmaul84ff3e52020-01-03 19:48:53 -0800302 "Connection",
James Kuszmaul7daef362019-12-31 18:28:17 -0800303 "Map",
304 "Node",
305 ],
306 visibility = ["//visibility:public"],
307)
308
John Park398c74a2018-10-20 21:17:39 -0700309cc_library(
310 name = "configuration",
311 srcs = [
312 "configuration.cc",
313 ],
314 hdrs = [
315 "configuration.h",
316 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800317 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700318 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700319 ":configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700320 ":flatbuffer_merge",
321 ":flatbuffers",
322 ":json_to_flatbuffer",
John Park398c74a2018-10-20 21:17:39 -0700323 "//aos:unique_malloc_ptr",
Austin Schuh217a9782019-12-21 23:02:50 -0800324 "//aos/network:team_number",
Austin Schuhcb108412019-10-13 16:09:54 -0700325 "//aos/util:file",
326 "@com_github_google_glog//:glog",
327 "@com_google_absl//absl/container:btree",
328 "@com_google_absl//absl/strings",
John Park398c74a2018-10-20 21:17:39 -0700329 ],
John Park398c74a2018-10-20 21:17:39 -0700330)
331
Brian Silvermanf819b442019-01-20 16:51:04 -0800332cc_library(
333 name = "make_unique",
334 hdrs = [
335 "make_unique.h",
336 ],
337 visibility = ["//visibility:public"],
338)
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700339
James Kuszmaulabb77132020-08-01 19:56:16 -0700340flatbuffer_ts_library(
341 name = "json_to_flatbuffer_flatbuffer_ts",
342 srcs = ["json_to_flatbuffer.fbs"],
343 visibility = ["//aos:__subpackages__"],
344)
345
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700346flatbuffer_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,
James Kuszmaulabb77132020-08-01 19:56:16 -0700350 visibility = ["//aos:__subpackages__"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700351)
352
353cc_library(
Austin Schuh43c6a352019-09-30 22:22:10 -0700354 name = "flatbuffer_utils",
355 srcs = ["flatbuffer_utils.cc"],
356 hdrs = ["flatbuffer_utils.h"],
357 deps = [
358 "@com_github_google_flatbuffers//:flatbuffers",
359 ],
360)
361
362cc_library(
Austin Schuhd7e252d2019-10-06 13:51:02 -0700363 name = "json_tokenizer",
364 srcs = ["json_tokenizer.cc"],
365 hdrs = ["json_tokenizer.h"],
366 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700367 "@com_github_google_glog//:glog",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700368 "@com_google_absl//absl/strings",
369 ],
370)
371
372cc_library(
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700373 name = "json_to_flatbuffer",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800374 srcs = [
375 "flatbuffer_introspection.cc",
376 "json_to_flatbuffer.cc",
377 ],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700378 hdrs = ["json_to_flatbuffer.h"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700379 visibility = ["//visibility:public"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700380 deps = [
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700381 ":fast_string_builder",
Austin Schuh43c6a352019-09-30 22:22:10 -0700382 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700383 ":flatbuffers",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700384 ":json_tokenizer",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700385 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuhe93d8642019-10-13 15:27:07 -0700386 "@com_github_google_glog//:glog",
Austin Schuhd339a9b2019-10-05 21:33:32 -0700387 "@com_google_absl//absl/strings",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700388 ],
389)
390
391cc_test(
392 name = "json_to_flatbuffer_test",
393 srcs = [
394 "json_to_flatbuffer_test.cc",
395 ],
396 deps = [
397 ":json_to_flatbuffer",
398 ":json_to_flatbuffer_flatbuffer",
399 "//aos/testing:googletest",
400 ],
401)
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700402
Tyler Chatow5e369a42019-11-23 11:57:31 -0800403cc_test(
404 name = "flatbuffer_introspection_test",
405 srcs = [
406 "flatbuffer_introspection_test.cc",
407 ],
408 data = [
409 ":json_to_flatbuffer_flatbuffer_reflection_out",
410 ],
411 deps = [
412 ":json_to_flatbuffer",
413 ":json_to_flatbuffer_flatbuffer",
414 "//aos/testing:googletest",
415 "//aos/util:file",
416 "@com_github_google_flatbuffers//:flatbuffers",
417 ],
418)
419
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700420cc_library(
421 name = "flatbuffer_merge",
422 srcs = ["flatbuffer_merge.cc"],
423 hdrs = ["flatbuffer_merge.h"],
424 copts = ["-Wno-cast-align"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700425 visibility = ["//visibility:public"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700426 deps = [
427 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700428 ":flatbuffers",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700429 "@com_github_google_flatbuffers//:flatbuffers",
430 ],
431)
432
433cc_test(
434 name = "flatbuffer_merge_test",
435 srcs = [
436 "flatbuffer_merge_test.cc",
437 ],
438 deps = [
439 ":flatbuffer_merge",
440 ":json_to_flatbuffer",
441 ":json_to_flatbuffer_flatbuffer",
442 "//aos/testing:googletest",
443 ],
444)
Austin Schuhe93d8642019-10-13 15:27:07 -0700445
446cc_library(
447 name = "flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700448 srcs = [
449 "flatbuffers.cc",
450 ],
Austin Schuhe93d8642019-10-13 15:27:07 -0700451 hdrs = [
452 "flatbuffers.h",
453 ],
Austin Schuh40485ed2019-10-26 21:51:44 -0700454 visibility = ["//visibility:public"],
Austin Schuhe93d8642019-10-13 15:27:07 -0700455 deps = [
James Kuszmaulad8a8082020-02-14 21:21:58 -0800456 "//aos:macros",
Brian Silverman354697a2020-09-22 21:06:32 -0700457 "//aos/containers:resizeable_buffer",
Austin Schuhe93d8642019-10-13 15:27:07 -0700458 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700459 "@com_github_google_glog//:glog",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700460 "@com_google_absl//absl/strings",
Austin Schuh6f3babe2020-01-26 20:34:50 -0800461 "@com_google_absl//absl/types:span",
Austin Schuhe93d8642019-10-13 15:27:07 -0700462 ],
463)
Austin Schuhcb108412019-10-13 16:09:54 -0700464
465cc_test(
466 name = "configuration_test",
467 srcs = [
468 "configuration_test.cc",
469 ],
470 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700471 "//aos/events:pingpong_config",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800472 "//aos/events:pong.bfbs",
James Kuszmaulc0c08da2020-05-10 18:56:07 -0700473 "//aos/testdata:test_configs",
Austin Schuhcb108412019-10-13 16:09:54 -0700474 ],
475 deps = [
476 ":configuration",
477 "//aos/testing:googletest",
478 "//aos/testing:test_logging",
479 ],
480)
Alex Perrycb7da4b2019-08-28 19:35:56 -0700481
482cc_binary(
483 name = "config_flattener",
484 srcs = [
485 "config_flattener.cc",
486 ],
487 visibility = ["//visibility:public"],
488 deps = [
489 ":configuration",
490 ":init",
491 "//aos/util:file",
492 "@com_github_google_glog//:glog",
493 ],
494)
Tyler Chatow5e369a42019-11-23 11:57:31 -0800495
496cc_binary(
Austin Schuh944df342019-12-21 17:08:55 -0800497 name = "aos_dump",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800498 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -0800499 "aos_dump.cc",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800500 ],
501 visibility = ["//visibility:public"],
502 deps = [
503 ":configuration",
504 ":json_to_flatbuffer",
505 "//aos:init",
506 "//aos/events:shm_event_loop",
507 "@com_github_google_glog//:glog",
508 ],
509)
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500510
511cc_library(
512 name = "ftrace",
513 srcs = [
514 "ftrace.cc",
515 ],
516 hdrs = [
517 "ftrace.h",
518 ],
519 visibility = ["//visibility:public"],
520 deps = [
521 "@com_github_google_glog//:glog",
522 ],
523)
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700524
525cc_library(
526 name = "fast_string_builder",
527 srcs = [
528 "fast_string_builder.cc",
529 ],
530 hdrs = [
531 "fast_string_builder.h",
532 ],
533 deps = [
534 "@com_github_google_glog//:glog",
535 "@com_google_absl//absl/strings",
536 "@com_google_absl//absl/strings:str_format",
537 ],
538)
Brian Silvermanb47f5552020-10-01 15:08:14 -0700539
540cc_library(
541 name = "thread_local",
542 hdrs = [
543 "thread_local.h",
544 ],
545 visibility = ["//visibility:public"],
546)
Austin Schuhcc6070c2020-10-10 20:25:56 -0700547
548cc_test(
549 name = "realtime_test",
550 srcs = [
551 "realtime_test.cc",
552 ],
553 visibility = ["//visibility:public"],
554 deps = [
555 ":realtime",
556 "//aos/testing:googletest",
557 ],
558)