blob: 2ed8aa94607412f45a1c2b0a41d46211315adc70 [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")
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 Schuh972e47e2018-12-20 17:20:58 -08007 "//aos:core",
John Park33858a32018-09-28 23:05:48 -07008 "//aos/logging:log_displayer",
9 "//aos/logging:log_streamer",
John Park398c74a2018-10-20 21:17:39 -070010 "//aos/starter",
Brian Silverman6470f442018-08-05 12:08:16 -070011 ],
12 visibility = ["//visibility:public"],
Austin Schuh1eceeb92015-11-08 21:16:06 -080013)
Austin Schuhc80dd152016-02-29 01:47:44 -080014
15filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070016 name = "prime_start_binaries",
17 srcs = [
John Park33858a32018-09-28 23:05:48 -070018 "//aos/logging:binary_log_writer",
Brian Silverman6470f442018-08-05 12:08:16 -070019 ],
20 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080021)
Brian Silverman6470f442018-08-05 12:08:16 -070022
Austin Schuhc80dd152016-02-29 01:47:44 -080023filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070024 name = "prime_binaries_stripped",
25 srcs = [
26 # starter is hard coded to look for a non-stripped core...
John Park398c74a2018-10-20 21:17:39 -070027 "//aos:core",
John Park33858a32018-09-28 23:05:48 -070028 "//aos/logging:log_streamer.stripped",
29 "//aos/logging:log_displayer.stripped",
John Park398c74a2018-10-20 21:17:39 -070030 "//aos/starter",
Brian Silverman6470f442018-08-05 12:08:16 -070031 ],
32 visibility = ["//visibility:public"],
33)
34
35filegroup(
36 name = "prime_start_binaries_stripped",
37 srcs = [
John Park33858a32018-09-28 23:05:48 -070038 "//aos/logging:binary_log_writer.stripped",
Brian Silverman6470f442018-08-05 12:08:16 -070039 ],
40 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080041)
Sabina Davis2ed5ea22017-09-26 22:27:42 -070042
43cc_library(
John Park33858a32018-09-28 23:05:48 -070044 name = "math",
45 hdrs = [
46 "commonmath.h",
47 ],
48 compatible_with = mcu_cpus,
49 visibility = ["//visibility:public"],
50)
51
52cc_library(
Brian Silverman6470f442018-08-05 12:08:16 -070053 name = "once",
54 srcs = [
55 "once-tmpl.h",
56 ],
57 hdrs = [
58 "once.h",
59 ],
60 visibility = ["//visibility:public"],
61 deps = [
John Park33858a32018-09-28 23:05:48 -070062 "//aos:gtest_prod",
Austin Schuh972e47e2018-12-20 17:20:58 -080063 "//aos/type_traits",
Brian Silverman6470f442018-08-05 12:08:16 -070064 ],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070065)
Brian Silverman6470f442018-08-05 12:08:16 -070066
John Park33858a32018-09-28 23:05:48 -070067cc_library(
68 name = "byteorder",
69 hdrs = [
70 "byteorder.h",
71 ],
John Park33858a32018-09-28 23:05:48 -070072 visibility = ["//visibility:public"],
73)
74
Sabina Davis2ed5ea22017-09-26 22:27:42 -070075cc_test(
Brian Silverman6470f442018-08-05 12:08:16 -070076 name = "once_test",
77 srcs = [
78 "once_test.cc",
79 ],
80 visibility = ["//visibility:public"],
81 deps = [
82 "//aos:once",
83 "//aos/testing:googletest",
84 ],
85)
86
87py_library(
88 name = "python_init",
89 srcs = ["__init__.py"],
90 visibility = ["//visibility:public"],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070091)
John Park33858a32018-09-28 23:05:48 -070092
93cc_library(
Austin Schuh972e47e2018-12-20 17:20:58 -080094 name = "macros",
95 hdrs = [
John Park33858a32018-09-28 23:05:48 -070096 "macros.h",
John Park33858a32018-09-28 23:05:48 -070097 ],
Austin Schuh972e47e2018-12-20 17:20:58 -080098 compatible_with = mcu_cpus,
John Park33858a32018-09-28 23:05:48 -070099 visibility = ["//visibility:public"],
100)
101
102cc_library(
103 name = "gtest_prod",
104 hdrs = [
105 "gtest_prod.h",
106 ],
John Park33858a32018-09-28 23:05:48 -0700107 visibility = ["//visibility:public"],
108)
109
110cc_library(
111 name = "network_port",
112 hdrs = [
113 "network_port.h",
114 ],
115 visibility = ["//visibility:public"],
116)
117
John Park33858a32018-09-28 23:05:48 -0700118cc_library(
119 name = "unique_malloc_ptr",
120 hdrs = [
121 "unique_malloc_ptr.h",
122 ],
John Park33858a32018-09-28 23:05:48 -0700123 visibility = ["//visibility:public"],
124)
125
126cc_library(
127 name = "condition",
128 srcs = [
129 "condition.cc",
130 ],
131 hdrs = [
132 "condition.h",
133 ],
John Park33858a32018-09-28 23:05:48 -0700134 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800135 deps = [
136 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800137 "//aos/mutex",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700138 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800139 ],
John Park33858a32018-09-28 23:05:48 -0700140)
141
142cc_test(
143 name = "condition_test",
144 srcs = [
145 "condition_test.cc",
146 ],
147 deps = [
148 ":condition",
149 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700150 "//aos/ipc_lib:aos_sync",
151 "//aos/ipc_lib:core_lib",
Austin Schuh972e47e2018-12-20 17:20:58 -0800152 "//aos/logging",
153 "//aos/mutex",
John Park33858a32018-09-28 23:05:48 -0700154 "//aos/testing:googletest",
155 "//aos/testing:prevent_exit",
156 "//aos/testing:test_shm",
Austin Schuh972e47e2018-12-20 17:20:58 -0800157 "//aos/time",
158 "//aos/util:thread",
John Park33858a32018-09-28 23:05:48 -0700159 ],
160)
161
162cc_library(
163 name = "die",
164 srcs = [
165 "die.cc",
166 ],
167 hdrs = [
168 "die.h",
169 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800170 visibility = ["//visibility:public"],
John Park33858a32018-09-28 23:05:48 -0700171 deps = [
172 "//aos:macros",
173 "//aos/libc:aos_strerror",
174 ],
John Park33858a32018-09-28 23:05:48 -0700175)
176
John Park33858a32018-09-28 23:05:48 -0700177cc_test(
178 name = "die_test",
179 srcs = [
180 "die_test.cc",
181 ],
182 deps = [
183 ":die",
184 "//aos/testing:googletest",
185 ],
186)
187
188cc_library(
189 name = "event",
190 srcs = [
191 "event.cc",
192 ],
193 hdrs = [
194 "event.h",
195 ],
John Park33858a32018-09-28 23:05:48 -0700196 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800197 deps = [
198 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800199 "//aos/time",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700200 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800201 ],
John Park33858a32018-09-28 23:05:48 -0700202)
203
204cc_test(
205 name = "event_test",
206 srcs = [
207 "event_test.cc",
Austin Schuh972e47e2018-12-20 17:20:58 -0800208 ],
John Park33858a32018-09-28 23:05:48 -0700209 deps = [
210 ":event",
John Park33858a32018-09-28 23:05:48 -0700211 "//aos/testing:googletest",
212 "//aos/testing:test_logging",
Austin Schuh972e47e2018-12-20 17:20:58 -0800213 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700214 ],
215)
John Park398c74a2018-10-20 21:17:39 -0700216
217cc_binary(
218 name = "dump_rtprio",
219 srcs = [
220 "dump_rtprio.cc",
221 ],
222 deps = [
John Park398c74a2018-10-20 21:17:39 -0700223 "//aos/logging",
224 "//aos/logging:implementations",
Austin Schuh972e47e2018-12-20 17:20:58 -0800225 "//aos/time",
John Park398c74a2018-10-20 21:17:39 -0700226 ],
227)
228
229cc_library(
John Park398c74a2018-10-20 21:17:39 -0700230 name = "complex_thread_local",
231 srcs = [
232 "complex_thread_local.cc",
233 ],
234 hdrs = [
235 "complex_thread_local.h",
236 ],
John Park398c74a2018-10-20 21:17:39 -0700237 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800238 deps = [
239 "//aos:die",
240 "//aos:once",
241 ],
John Park398c74a2018-10-20 21:17:39 -0700242)
243
244cc_test(
245 name = "complex_thread_local_test",
246 srcs = [
247 "complex_thread_local_test.cc",
248 ],
249 deps = [
250 ":complex_thread_local",
251 "//aos/logging",
John Park398c74a2018-10-20 21:17:39 -0700252 "//aos/testing:googletest",
Austin Schuh972e47e2018-12-20 17:20:58 -0800253 "//aos/util:thread",
John Park398c74a2018-10-20 21:17:39 -0700254 ],
255)
256
257cc_library(
258 name = "init",
259 srcs = [
260 "init.cc",
261 ],
262 hdrs = [
263 "init.h",
264 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800265 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700266 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700267 ":realtime",
John Park398c74a2018-10-20 21:17:39 -0700268 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700269 "//aos/ipc_lib:shared_mem",
Austin Schuh972e47e2018-12-20 17:20:58 -0800270 "//aos/logging:implementations",
John Park398c74a2018-10-20 21:17:39 -0700271 ],
John Park398c74a2018-10-20 21:17:39 -0700272)
273
Alex Perrycb7da4b2019-08-28 19:35:56 -0700274cc_library(
275 name = "realtime",
276 srcs = [
277 "realtime.cc",
278 ],
279 hdrs = [
280 "realtime.h",
281 ],
282 visibility = ["//visibility:public"],
283 deps = [
284 "@com_github_google_glog//:glog",
285 ],
286)
287
Austin Schuhcb108412019-10-13 16:09:54 -0700288flatbuffer_cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700289 name = "configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700290 srcs = ["configuration.fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700291 visibility = ["//visibility:public"],
Austin Schuhcb108412019-10-13 16:09:54 -0700292)
293
John Park398c74a2018-10-20 21:17:39 -0700294cc_library(
295 name = "configuration",
296 srcs = [
297 "configuration.cc",
298 ],
299 hdrs = [
300 "configuration.h",
301 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800302 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700303 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700304 ":configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700305 ":flatbuffer_merge",
306 ":flatbuffers",
307 ":json_to_flatbuffer",
John Park398c74a2018-10-20 21:17:39 -0700308 "//aos:unique_malloc_ptr",
Austin Schuhcb108412019-10-13 16:09:54 -0700309 "//aos/util:file",
310 "@com_github_google_glog//:glog",
James Kuszmaul872efd22019-12-03 20:59:09 -0800311 "@com_google_absl//absl/base",
Austin Schuhcb108412019-10-13 16:09:54 -0700312 "@com_google_absl//absl/container:btree",
313 "@com_google_absl//absl/strings",
John Park398c74a2018-10-20 21:17:39 -0700314 ],
John Park398c74a2018-10-20 21:17:39 -0700315)
316
317cc_binary(
318 name = "core",
319 srcs = [
320 "core.cc",
321 ],
322 deps = [
323 ":init",
324 "//aos/util:run_command",
325 ],
326)
Brian Silvermanf819b442019-01-20 16:51:04 -0800327
328cc_library(
329 name = "make_unique",
330 hdrs = [
331 "make_unique.h",
332 ],
333 visibility = ["//visibility:public"],
334)
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700335
336flatbuffer_cc_library(
337 name = "json_to_flatbuffer_flatbuffer",
338 srcs = ["json_to_flatbuffer.fbs"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800339 gen_reflections = 1,
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700340)
341
342cc_library(
Austin Schuh43c6a352019-09-30 22:22:10 -0700343 name = "flatbuffer_utils",
344 srcs = ["flatbuffer_utils.cc"],
345 hdrs = ["flatbuffer_utils.h"],
346 deps = [
347 "@com_github_google_flatbuffers//:flatbuffers",
348 ],
349)
350
351cc_library(
Austin Schuhd7e252d2019-10-06 13:51:02 -0700352 name = "json_tokenizer",
353 srcs = ["json_tokenizer.cc"],
354 hdrs = ["json_tokenizer.h"],
355 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700356 "@com_github_google_glog//:glog",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700357 "@com_google_absl//absl/strings",
358 ],
359)
360
361cc_library(
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700362 name = "json_to_flatbuffer",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800363 srcs = [
364 "flatbuffer_introspection.cc",
365 "json_to_flatbuffer.cc",
366 ],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700367 hdrs = ["json_to_flatbuffer.h"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700368 visibility = ["//visibility:public"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700369 deps = [
Austin Schuh43c6a352019-09-30 22:22:10 -0700370 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700371 ":flatbuffers",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700372 ":json_tokenizer",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700373 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuhe93d8642019-10-13 15:27:07 -0700374 "@com_github_google_glog//:glog",
Austin Schuhd339a9b2019-10-05 21:33:32 -0700375 "@com_google_absl//absl/strings",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700376 ],
377)
378
379cc_test(
380 name = "json_to_flatbuffer_test",
381 srcs = [
382 "json_to_flatbuffer_test.cc",
383 ],
384 deps = [
385 ":json_to_flatbuffer",
386 ":json_to_flatbuffer_flatbuffer",
387 "//aos/testing:googletest",
388 ],
389)
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700390
Tyler Chatow5e369a42019-11-23 11:57:31 -0800391cc_test(
392 name = "flatbuffer_introspection_test",
393 srcs = [
394 "flatbuffer_introspection_test.cc",
395 ],
396 data = [
397 ":json_to_flatbuffer_flatbuffer_reflection_out",
398 ],
399 deps = [
400 ":json_to_flatbuffer",
401 ":json_to_flatbuffer_flatbuffer",
402 "//aos/testing:googletest",
403 "//aos/util:file",
404 "@com_github_google_flatbuffers//:flatbuffers",
405 ],
406)
407
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700408cc_library(
409 name = "flatbuffer_merge",
410 srcs = ["flatbuffer_merge.cc"],
411 hdrs = ["flatbuffer_merge.h"],
412 copts = ["-Wno-cast-align"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700413 visibility = ["//visibility:public"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700414 deps = [
415 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700416 ":flatbuffers",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700417 "@com_github_google_flatbuffers//:flatbuffers",
418 ],
419)
420
421cc_test(
422 name = "flatbuffer_merge_test",
423 srcs = [
424 "flatbuffer_merge_test.cc",
425 ],
426 deps = [
427 ":flatbuffer_merge",
428 ":json_to_flatbuffer",
429 ":json_to_flatbuffer_flatbuffer",
430 "//aos/testing:googletest",
431 ],
432)
Austin Schuhe93d8642019-10-13 15:27:07 -0700433
434cc_library(
435 name = "flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700436 srcs = [
437 "flatbuffers.cc",
438 ],
Austin Schuhe93d8642019-10-13 15:27:07 -0700439 hdrs = [
440 "flatbuffers.h",
441 ],
Austin Schuh40485ed2019-10-26 21:51:44 -0700442 visibility = ["//visibility:public"],
Austin Schuhe93d8642019-10-13 15:27:07 -0700443 deps = [
444 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700445 "@com_github_google_glog//:glog",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700446 "@com_google_absl//absl/strings",
Austin Schuhe93d8642019-10-13 15:27:07 -0700447 ],
448)
Austin Schuhcb108412019-10-13 16:09:54 -0700449
450cc_test(
451 name = "configuration_test",
452 srcs = [
453 "configuration_test.cc",
454 ],
455 data = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700456 "testdata/backwards.json",
Austin Schuhcb108412019-10-13 16:09:54 -0700457 "testdata/config1.json",
458 "testdata/config1_bad.json",
459 "testdata/config2.json",
460 "testdata/config3.json",
461 "testdata/expected.json",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800462 "//aos/events:pingpong_config.json",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800463 "//aos/events:pong.bfbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700464 ],
465 deps = [
466 ":configuration",
467 "//aos/testing:googletest",
468 "//aos/testing:test_logging",
469 ],
470)
Alex Perrycb7da4b2019-08-28 19:35:56 -0700471
472cc_binary(
473 name = "config_flattener",
474 srcs = [
475 "config_flattener.cc",
476 ],
477 visibility = ["//visibility:public"],
478 deps = [
479 ":configuration",
480 ":init",
481 "//aos/util:file",
482 "@com_github_google_glog//:glog",
483 ],
484)
Tyler Chatow5e369a42019-11-23 11:57:31 -0800485
486cc_binary(
487 name = "log_fbs_shmem",
488 srcs = [
489 "log_fbs_shmem.cc",
490 ],
491 visibility = ["//visibility:public"],
492 deps = [
493 ":configuration",
494 ":json_to_flatbuffer",
495 "//aos:init",
496 "//aos/events:shm_event_loop",
497 "@com_github_google_glog//:glog",
498 ],
499)