blob: 206eefb416cde7b05378592fd124ddb7652c6fdf [file] [log] [blame]
John Park33858a32018-09-28 23:05:48 -07001load("//tools:environments.bzl", "mcu_cpus")
Austin Schuh3e95e5d2019-09-20 00:08:54 -07002load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
John Park33858a32018-09-28 23:05:48 -07003load("//aos/build:queues.bzl", "queue_library")
Austin Schuh972e47e2018-12-20 17:20:58 -08004
Brian Silverman258b9172015-09-19 14:32:57 -04005filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -07006 name = "prime_binaries",
7 srcs = [
Austin Schuh972e47e2018-12-20 17:20:58 -08008 "//aos:core",
John Park33858a32018-09-28 23:05:48 -07009 "//aos/logging:log_displayer",
10 "//aos/logging:log_streamer",
John Park398c74a2018-10-20 21:17:39 -070011 "//aos/starter",
Brian Silverman6470f442018-08-05 12:08:16 -070012 ],
13 visibility = ["//visibility:public"],
Austin Schuh1eceeb92015-11-08 21:16:06 -080014)
Austin Schuhc80dd152016-02-29 01:47:44 -080015
16filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070017 name = "prime_start_binaries",
18 srcs = [
John Park33858a32018-09-28 23:05:48 -070019 "//aos/logging:binary_log_writer",
Brian Silverman6470f442018-08-05 12:08:16 -070020 ],
21 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080022)
Brian Silverman6470f442018-08-05 12:08:16 -070023
Austin Schuhc80dd152016-02-29 01:47:44 -080024filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070025 name = "prime_binaries_stripped",
26 srcs = [
27 # starter is hard coded to look for a non-stripped core...
John Park398c74a2018-10-20 21:17:39 -070028 "//aos:core",
John Park33858a32018-09-28 23:05:48 -070029 "//aos/logging:log_streamer.stripped",
30 "//aos/logging:log_displayer.stripped",
John Park398c74a2018-10-20 21:17:39 -070031 "//aos/starter",
Brian Silverman6470f442018-08-05 12:08:16 -070032 ],
33 visibility = ["//visibility:public"],
34)
35
36filegroup(
37 name = "prime_start_binaries_stripped",
38 srcs = [
John Park33858a32018-09-28 23:05:48 -070039 "//aos/logging:binary_log_writer.stripped",
Brian Silverman6470f442018-08-05 12:08:16 -070040 ],
41 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080042)
Sabina Davis2ed5ea22017-09-26 22:27:42 -070043
44cc_library(
John Park33858a32018-09-28 23:05:48 -070045 name = "math",
46 hdrs = [
47 "commonmath.h",
48 ],
49 compatible_with = mcu_cpus,
50 visibility = ["//visibility:public"],
51)
52
53cc_library(
Brian Silverman6470f442018-08-05 12:08:16 -070054 name = "once",
55 srcs = [
56 "once-tmpl.h",
57 ],
58 hdrs = [
59 "once.h",
60 ],
61 visibility = ["//visibility:public"],
62 deps = [
John Park33858a32018-09-28 23:05:48 -070063 "//aos:gtest_prod",
Austin Schuh972e47e2018-12-20 17:20:58 -080064 "//aos/type_traits",
Brian Silverman6470f442018-08-05 12:08:16 -070065 ],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070066)
Brian Silverman6470f442018-08-05 12:08:16 -070067
John Park33858a32018-09-28 23:05:48 -070068cc_library(
69 name = "byteorder",
70 hdrs = [
71 "byteorder.h",
72 ],
John Park33858a32018-09-28 23:05:48 -070073 visibility = ["//visibility:public"],
74)
75
Sabina Davis2ed5ea22017-09-26 22:27:42 -070076cc_test(
Brian Silverman6470f442018-08-05 12:08:16 -070077 name = "once_test",
78 srcs = [
79 "once_test.cc",
80 ],
81 visibility = ["//visibility:public"],
82 deps = [
83 "//aos:once",
84 "//aos/testing:googletest",
85 ],
86)
87
88py_library(
89 name = "python_init",
90 srcs = ["__init__.py"],
91 visibility = ["//visibility:public"],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070092)
John Park33858a32018-09-28 23:05:48 -070093
94cc_library(
Austin Schuh972e47e2018-12-20 17:20:58 -080095 name = "macros",
96 hdrs = [
John Park33858a32018-09-28 23:05:48 -070097 "macros.h",
John Park33858a32018-09-28 23:05:48 -070098 ],
Austin Schuh972e47e2018-12-20 17:20:58 -080099 compatible_with = mcu_cpus,
John Park33858a32018-09-28 23:05:48 -0700100 visibility = ["//visibility:public"],
101)
102
103cc_library(
104 name = "gtest_prod",
105 hdrs = [
106 "gtest_prod.h",
107 ],
John Park33858a32018-09-28 23:05:48 -0700108 visibility = ["//visibility:public"],
109)
110
111cc_library(
112 name = "network_port",
113 hdrs = [
114 "network_port.h",
115 ],
116 visibility = ["//visibility:public"],
117)
118
119genrule(
120 name = "gen_print_field",
121 outs = ["print_field.cc"],
122 cmd = "$(location //aos/build/queues:print_field) $@",
John Park33858a32018-09-28 23:05:48 -0700123 tools = ["//aos/build/queues:print_field"],
124 visibility = ["//visibility:private"],
125)
126
127cc_library(
128 name = "queue_types",
129 srcs = [
130 "print_field_helpers.h",
131 "queue_types.cc",
132 ":gen_print_field",
133 ],
134 hdrs = [
135 "queue_types.h",
136 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800137 visibility = ["//visibility:public"],
John Park33858a32018-09-28 23:05:48 -0700138 deps = [
John Park33858a32018-09-28 23:05:48 -0700139 ":generated_queue_headers",
Austin Schuh972e47e2018-12-20 17:20:58 -0800140 "//aos:byteorder",
John Park398c74a2018-10-20 21:17:39 -0700141 "//aos/ipc_lib:core_lib",
142 "//aos/ipc_lib:shared_mem",
Austin Schuh972e47e2018-12-20 17:20:58 -0800143 "//aos/logging:printf_formats",
144 "//aos/mutex",
145 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700146 ],
John Park33858a32018-09-28 23:05:48 -0700147)
148
149cc_test(
150 name = "queue_types_test",
151 srcs = [
152 "queue_types_test.cc",
153 ],
154 deps = [
155 ":queue_types",
156 ":test_queue",
157 "//aos/logging",
158 "//aos/testing:googletest",
159 "//aos/testing:test_logging",
160 ],
161)
162
163cc_library(
164 name = "queues",
165 hdrs = [
166 "queue.h",
167 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800168 visibility = ["//visibility:public"],
John Park33858a32018-09-28 23:05:48 -0700169 deps = [
John Park398c74a2018-10-20 21:17:39 -0700170 "//aos:queue",
171 "//aos/ipc_lib:queue",
Austin Schuh972e47e2018-12-20 17:20:58 -0800172 "//aos/messages",
John Park33858a32018-09-28 23:05:48 -0700173 ],
John Park33858a32018-09-28 23:05:48 -0700174)
175
176queue_library(
177 name = "test_queue",
178 srcs = [
179 "test_queue.q",
180 ],
181)
182
183genrule(
184 name = "gen_queue_primitives",
185 outs = ["queue_primitives.h"],
186 cmd = "$(location //aos/build/queues:queue_primitives) $@",
John Park33858a32018-09-28 23:05:48 -0700187 tools = ["//aos/build/queues:queue_primitives"],
188 visibility = ["//visibility:private"],
189)
190
191cc_library(
192 name = "generated_queue_headers",
193 hdrs = [
194 ":gen_queue_primitives",
195 ],
John Park33858a32018-09-28 23:05:48 -0700196 visibility = ["//aos/logging:__pkg__"],
197)
198
199cc_test(
200 name = "queue_test",
201 srcs = [
202 "queue_test.cc",
203 ],
204 deps = [
John Park33858a32018-09-28 23:05:48 -0700205 ":test_queue",
Austin Schuh972e47e2018-12-20 17:20:58 -0800206 "//aos:die",
John Park33858a32018-09-28 23:05:48 -0700207 "//aos/testing:googletest",
208 "//aos/testing:test_shm",
Austin Schuh972e47e2018-12-20 17:20:58 -0800209 "//aos/util:thread",
John Park33858a32018-09-28 23:05:48 -0700210 ],
211)
212
213cc_library(
214 name = "unique_malloc_ptr",
215 hdrs = [
216 "unique_malloc_ptr.h",
217 ],
John Park33858a32018-09-28 23:05:48 -0700218 visibility = ["//visibility:public"],
219)
220
221cc_library(
222 name = "condition",
223 srcs = [
224 "condition.cc",
225 ],
226 hdrs = [
227 "condition.h",
228 ],
John Park33858a32018-09-28 23:05:48 -0700229 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800230 deps = [
231 "//aos/ipc_lib:aos_sync",
232 "//aos/logging",
233 "//aos/mutex",
234 ],
John Park33858a32018-09-28 23:05:48 -0700235)
236
237cc_test(
238 name = "condition_test",
239 srcs = [
240 "condition_test.cc",
241 ],
242 deps = [
243 ":condition",
244 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700245 "//aos/ipc_lib:aos_sync",
246 "//aos/ipc_lib:core_lib",
Austin Schuh972e47e2018-12-20 17:20:58 -0800247 "//aos/logging",
248 "//aos/mutex",
John Park33858a32018-09-28 23:05:48 -0700249 "//aos/testing:googletest",
250 "//aos/testing:prevent_exit",
251 "//aos/testing:test_shm",
Austin Schuh972e47e2018-12-20 17:20:58 -0800252 "//aos/time",
253 "//aos/util:thread",
John Park33858a32018-09-28 23:05:48 -0700254 ],
255)
256
257cc_library(
258 name = "die",
259 srcs = [
260 "die.cc",
261 ],
262 hdrs = [
263 "die.h",
264 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800265 visibility = ["//visibility:public"],
John Park33858a32018-09-28 23:05:48 -0700266 deps = [
267 "//aos:macros",
268 "//aos/libc:aos_strerror",
269 ],
John Park33858a32018-09-28 23:05:48 -0700270)
271
John Park33858a32018-09-28 23:05:48 -0700272cc_test(
273 name = "die_test",
274 srcs = [
275 "die_test.cc",
276 ],
277 deps = [
278 ":die",
279 "//aos/testing:googletest",
280 ],
281)
282
283cc_library(
284 name = "event",
285 srcs = [
286 "event.cc",
287 ],
288 hdrs = [
289 "event.h",
290 ],
John Park33858a32018-09-28 23:05:48 -0700291 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800292 deps = [
293 "//aos/ipc_lib:aos_sync",
294 "//aos/logging",
295 "//aos/time",
296 ],
John Park33858a32018-09-28 23:05:48 -0700297)
298
299cc_test(
300 name = "event_test",
301 srcs = [
302 "event_test.cc",
Austin Schuh972e47e2018-12-20 17:20:58 -0800303 ],
John Park33858a32018-09-28 23:05:48 -0700304 deps = [
305 ":event",
John Park33858a32018-09-28 23:05:48 -0700306 "//aos/testing:googletest",
307 "//aos/testing:test_logging",
Austin Schuh972e47e2018-12-20 17:20:58 -0800308 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700309 ],
310)
John Park398c74a2018-10-20 21:17:39 -0700311
312cc_binary(
313 name = "dump_rtprio",
314 srcs = [
315 "dump_rtprio.cc",
316 ],
317 deps = [
John Park398c74a2018-10-20 21:17:39 -0700318 "//aos/logging",
319 "//aos/logging:implementations",
Austin Schuh972e47e2018-12-20 17:20:58 -0800320 "//aos/time",
John Park398c74a2018-10-20 21:17:39 -0700321 ],
322)
323
324cc_library(
325 name = "queue",
326 hdrs = [
327 "queue-tmpl.h",
328 ],
John Park398c74a2018-10-20 21:17:39 -0700329 visibility = ["//aos:__pkg__"],
330)
331
332cc_library(
333 name = "complex_thread_local",
334 srcs = [
335 "complex_thread_local.cc",
336 ],
337 hdrs = [
338 "complex_thread_local.h",
339 ],
John Park398c74a2018-10-20 21:17:39 -0700340 linkopts = [
341 "-lpthread",
342 ],
John Park398c74a2018-10-20 21:17:39 -0700343 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800344 deps = [
345 "//aos:die",
346 "//aos:once",
347 ],
John Park398c74a2018-10-20 21:17:39 -0700348)
349
350cc_test(
351 name = "complex_thread_local_test",
352 srcs = [
353 "complex_thread_local_test.cc",
354 ],
355 deps = [
356 ":complex_thread_local",
357 "//aos/logging",
John Park398c74a2018-10-20 21:17:39 -0700358 "//aos/testing:googletest",
Austin Schuh972e47e2018-12-20 17:20:58 -0800359 "//aos/util:thread",
John Park398c74a2018-10-20 21:17:39 -0700360 ],
361)
362
363cc_library(
364 name = "init",
365 srcs = [
366 "init.cc",
367 ],
368 hdrs = [
369 "init.h",
370 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800371 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700372 deps = [
373 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700374 "//aos/ipc_lib:shared_mem",
Austin Schuh972e47e2018-12-20 17:20:58 -0800375 "//aos/logging:implementations",
John Park398c74a2018-10-20 21:17:39 -0700376 ],
John Park398c74a2018-10-20 21:17:39 -0700377)
378
Austin Schuhcb108412019-10-13 16:09:54 -0700379flatbuffer_cc_library(
380 name = "configuration_flatbuffer",
381 srcs = ["configuration.fbs"],
382)
383
John Park398c74a2018-10-20 21:17:39 -0700384cc_library(
385 name = "configuration",
386 srcs = [
387 "configuration.cc",
388 ],
389 hdrs = [
390 "configuration.h",
391 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800392 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700393 deps = [
Austin Schuhcb108412019-10-13 16:09:54 -0700394 ":configuration_flatbuffer",
395 ":flatbuffer_merge",
396 ":flatbuffers",
397 ":json_to_flatbuffer",
John Park398c74a2018-10-20 21:17:39 -0700398 "//aos:once",
399 "//aos:unique_malloc_ptr",
400 "//aos/logging",
Austin Schuhcb108412019-10-13 16:09:54 -0700401 "//aos/util:file",
402 "@com_github_google_glog//:glog",
403 "@com_google_absl//absl/container:btree",
404 "@com_google_absl//absl/strings",
John Park398c74a2018-10-20 21:17:39 -0700405 ],
John Park398c74a2018-10-20 21:17:39 -0700406)
407
408cc_binary(
409 name = "core",
410 srcs = [
411 "core.cc",
412 ],
413 deps = [
414 ":init",
415 "//aos/util:run_command",
416 ],
417)
Brian Silvermanf819b442019-01-20 16:51:04 -0800418
419cc_library(
420 name = "make_unique",
421 hdrs = [
422 "make_unique.h",
423 ],
424 visibility = ["//visibility:public"],
425)
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700426
427flatbuffer_cc_library(
428 name = "json_to_flatbuffer_flatbuffer",
429 srcs = ["json_to_flatbuffer.fbs"],
430)
431
432cc_library(
Austin Schuh43c6a352019-09-30 22:22:10 -0700433 name = "flatbuffer_utils",
434 srcs = ["flatbuffer_utils.cc"],
435 hdrs = ["flatbuffer_utils.h"],
436 deps = [
437 "@com_github_google_flatbuffers//:flatbuffers",
438 ],
439)
440
441cc_library(
Austin Schuhd7e252d2019-10-06 13:51:02 -0700442 name = "json_tokenizer",
443 srcs = ["json_tokenizer.cc"],
444 hdrs = ["json_tokenizer.h"],
445 deps = [
446 "@com_google_absl//absl/strings",
447 ],
448)
449
450cc_library(
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700451 name = "json_to_flatbuffer",
452 srcs = ["json_to_flatbuffer.cc"],
453 hdrs = ["json_to_flatbuffer.h"],
454 deps = [
Austin Schuh43c6a352019-09-30 22:22:10 -0700455 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700456 ":flatbuffers",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700457 ":json_tokenizer",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700458 "//aos/logging",
459 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuhe93d8642019-10-13 15:27:07 -0700460 "@com_github_google_glog//:glog",
Austin Schuhd339a9b2019-10-05 21:33:32 -0700461 "@com_google_absl//absl/strings",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700462 ],
463)
464
465cc_test(
466 name = "json_to_flatbuffer_test",
467 srcs = [
468 "json_to_flatbuffer_test.cc",
469 ],
470 deps = [
471 ":json_to_flatbuffer",
472 ":json_to_flatbuffer_flatbuffer",
473 "//aos/testing:googletest",
474 ],
475)
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700476
477cc_library(
478 name = "flatbuffer_merge",
479 srcs = ["flatbuffer_merge.cc"],
480 hdrs = ["flatbuffer_merge.h"],
481 copts = ["-Wno-cast-align"],
482 deps = [
483 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700484 ":flatbuffers",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700485 "@com_github_google_flatbuffers//:flatbuffers",
486 ],
487)
488
489cc_test(
490 name = "flatbuffer_merge_test",
491 srcs = [
492 "flatbuffer_merge_test.cc",
493 ],
494 deps = [
495 ":flatbuffer_merge",
496 ":json_to_flatbuffer",
497 ":json_to_flatbuffer_flatbuffer",
498 "//aos/testing:googletest",
499 ],
500)
Austin Schuhe93d8642019-10-13 15:27:07 -0700501
502cc_library(
503 name = "flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700504 srcs = [
505 "flatbuffers.cc",
506 ],
Austin Schuhe93d8642019-10-13 15:27:07 -0700507 hdrs = [
508 "flatbuffers.h",
509 ],
Austin Schuh40485ed2019-10-26 21:51:44 -0700510 visibility = ["//visibility:public"],
Austin Schuhe93d8642019-10-13 15:27:07 -0700511 deps = [
512 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700513 "@com_github_google_glog//:glog",
Austin Schuhe93d8642019-10-13 15:27:07 -0700514 ],
515)
Austin Schuhcb108412019-10-13 16:09:54 -0700516
517cc_test(
518 name = "configuration_test",
519 srcs = [
520 "configuration_test.cc",
521 ],
522 data = [
523 "testdata/config1.json",
524 "testdata/config1_bad.json",
525 "testdata/config2.json",
526 "testdata/config3.json",
527 "testdata/expected.json",
528 ],
529 deps = [
530 ":configuration",
531 "//aos/testing:googletest",
532 "//aos/testing:test_logging",
533 ],
534)