blob: 788224486c55f89d992c0383f32f2650d45333f0 [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 = [
James Kuszmaul38735e82019-12-07 16:42:06 -080018 "//aos/events/logging:logger_main",
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",
James Kuszmaul5c22e082019-12-14 20:43:07 -080031 "//aos:log_fbs_shmem.stripped",
John Park398c74a2018-10-20 21:17:39 -070032 "//aos/starter",
Brian Silverman6470f442018-08-05 12:08:16 -070033 ],
34 visibility = ["//visibility:public"],
35)
36
37filegroup(
38 name = "prime_start_binaries_stripped",
39 srcs = [
James Kuszmaul38735e82019-12-07 16:42:06 -080040 "//aos/events/logging:logger_main.stripped",
John Park33858a32018-09-28 23:05:48 -070041 "//aos/logging:binary_log_writer.stripped",
Brian Silverman6470f442018-08-05 12:08:16 -070042 ],
43 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080044)
Sabina Davis2ed5ea22017-09-26 22:27:42 -070045
46cc_library(
John Park33858a32018-09-28 23:05:48 -070047 name = "math",
48 hdrs = [
49 "commonmath.h",
50 ],
51 compatible_with = mcu_cpus,
52 visibility = ["//visibility:public"],
53)
54
55cc_library(
Brian Silverman6470f442018-08-05 12:08:16 -070056 name = "once",
57 srcs = [
58 "once-tmpl.h",
59 ],
60 hdrs = [
61 "once.h",
62 ],
63 visibility = ["//visibility:public"],
64 deps = [
John Park33858a32018-09-28 23:05:48 -070065 "//aos:gtest_prod",
Austin Schuh972e47e2018-12-20 17:20:58 -080066 "//aos/type_traits",
Brian Silverman6470f442018-08-05 12:08:16 -070067 ],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070068)
Brian Silverman6470f442018-08-05 12:08:16 -070069
John Park33858a32018-09-28 23:05:48 -070070cc_library(
71 name = "byteorder",
72 hdrs = [
73 "byteorder.h",
74 ],
John Park33858a32018-09-28 23:05:48 -070075 visibility = ["//visibility:public"],
76)
77
Sabina Davis2ed5ea22017-09-26 22:27:42 -070078cc_test(
Brian Silverman6470f442018-08-05 12:08:16 -070079 name = "once_test",
80 srcs = [
81 "once_test.cc",
82 ],
83 visibility = ["//visibility:public"],
84 deps = [
85 "//aos:once",
86 "//aos/testing:googletest",
87 ],
88)
89
90py_library(
91 name = "python_init",
92 srcs = ["__init__.py"],
93 visibility = ["//visibility:public"],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070094)
John Park33858a32018-09-28 23:05:48 -070095
96cc_library(
Austin Schuh972e47e2018-12-20 17:20:58 -080097 name = "macros",
98 hdrs = [
John Park33858a32018-09-28 23:05:48 -070099 "macros.h",
John Park33858a32018-09-28 23:05:48 -0700100 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800101 compatible_with = mcu_cpus,
John Park33858a32018-09-28 23:05:48 -0700102 visibility = ["//visibility:public"],
103)
104
105cc_library(
106 name = "gtest_prod",
107 hdrs = [
108 "gtest_prod.h",
109 ],
John Park33858a32018-09-28 23:05:48 -0700110 visibility = ["//visibility:public"],
111)
112
113cc_library(
114 name = "network_port",
115 hdrs = [
116 "network_port.h",
117 ],
118 visibility = ["//visibility:public"],
119)
120
John Park33858a32018-09-28 23:05:48 -0700121cc_library(
122 name = "unique_malloc_ptr",
123 hdrs = [
124 "unique_malloc_ptr.h",
125 ],
John Park33858a32018-09-28 23:05:48 -0700126 visibility = ["//visibility:public"],
127)
128
129cc_library(
130 name = "condition",
131 srcs = [
132 "condition.cc",
133 ],
134 hdrs = [
135 "condition.h",
136 ],
John Park33858a32018-09-28 23:05:48 -0700137 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800138 deps = [
139 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800140 "//aos/mutex",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700141 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800142 ],
John Park33858a32018-09-28 23:05:48 -0700143)
144
145cc_test(
146 name = "condition_test",
147 srcs = [
148 "condition_test.cc",
149 ],
150 deps = [
151 ":condition",
152 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700153 "//aos/ipc_lib:aos_sync",
154 "//aos/ipc_lib:core_lib",
Austin Schuh972e47e2018-12-20 17:20:58 -0800155 "//aos/logging",
156 "//aos/mutex",
John Park33858a32018-09-28 23:05:48 -0700157 "//aos/testing:googletest",
158 "//aos/testing:prevent_exit",
159 "//aos/testing:test_shm",
Austin Schuh972e47e2018-12-20 17:20:58 -0800160 "//aos/time",
161 "//aos/util:thread",
John Park33858a32018-09-28 23:05:48 -0700162 ],
163)
164
165cc_library(
166 name = "die",
167 srcs = [
168 "die.cc",
169 ],
170 hdrs = [
171 "die.h",
172 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800173 visibility = ["//visibility:public"],
John Park33858a32018-09-28 23:05:48 -0700174 deps = [
175 "//aos:macros",
176 "//aos/libc:aos_strerror",
177 ],
John Park33858a32018-09-28 23:05:48 -0700178)
179
John Park33858a32018-09-28 23:05:48 -0700180cc_test(
181 name = "die_test",
182 srcs = [
183 "die_test.cc",
184 ],
185 deps = [
186 ":die",
187 "//aos/testing:googletest",
188 ],
189)
190
191cc_library(
192 name = "event",
193 srcs = [
194 "event.cc",
195 ],
196 hdrs = [
197 "event.h",
198 ],
John Park33858a32018-09-28 23:05:48 -0700199 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800200 deps = [
201 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800202 "//aos/time",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700203 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800204 ],
John Park33858a32018-09-28 23:05:48 -0700205)
206
207cc_test(
208 name = "event_test",
209 srcs = [
210 "event_test.cc",
Austin Schuh972e47e2018-12-20 17:20:58 -0800211 ],
John Park33858a32018-09-28 23:05:48 -0700212 deps = [
213 ":event",
John Park33858a32018-09-28 23:05:48 -0700214 "//aos/testing:googletest",
215 "//aos/testing:test_logging",
Austin Schuh972e47e2018-12-20 17:20:58 -0800216 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700217 ],
218)
John Park398c74a2018-10-20 21:17:39 -0700219
220cc_binary(
221 name = "dump_rtprio",
222 srcs = [
223 "dump_rtprio.cc",
224 ],
225 deps = [
John Park398c74a2018-10-20 21:17:39 -0700226 "//aos/logging",
227 "//aos/logging:implementations",
Austin Schuh972e47e2018-12-20 17:20:58 -0800228 "//aos/time",
John Park398c74a2018-10-20 21:17:39 -0700229 ],
230)
231
232cc_library(
John Park398c74a2018-10-20 21:17:39 -0700233 name = "complex_thread_local",
234 srcs = [
235 "complex_thread_local.cc",
236 ],
237 hdrs = [
238 "complex_thread_local.h",
239 ],
John Park398c74a2018-10-20 21:17:39 -0700240 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800241 deps = [
242 "//aos:die",
243 "//aos:once",
244 ],
John Park398c74a2018-10-20 21:17:39 -0700245)
246
247cc_test(
248 name = "complex_thread_local_test",
249 srcs = [
250 "complex_thread_local_test.cc",
251 ],
252 deps = [
253 ":complex_thread_local",
254 "//aos/logging",
John Park398c74a2018-10-20 21:17:39 -0700255 "//aos/testing:googletest",
Austin Schuh972e47e2018-12-20 17:20:58 -0800256 "//aos/util:thread",
John Park398c74a2018-10-20 21:17:39 -0700257 ],
258)
259
260cc_library(
261 name = "init",
262 srcs = [
263 "init.cc",
264 ],
265 hdrs = [
266 "init.h",
267 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800268 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700269 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700270 ":realtime",
John Park398c74a2018-10-20 21:17:39 -0700271 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700272 "//aos/ipc_lib:shared_mem",
Austin Schuh972e47e2018-12-20 17:20:58 -0800273 "//aos/logging:implementations",
John Park398c74a2018-10-20 21:17:39 -0700274 ],
John Park398c74a2018-10-20 21:17:39 -0700275)
276
Alex Perrycb7da4b2019-08-28 19:35:56 -0700277cc_library(
278 name = "realtime",
279 srcs = [
280 "realtime.cc",
281 ],
282 hdrs = [
283 "realtime.h",
284 ],
285 visibility = ["//visibility:public"],
286 deps = [
287 "@com_github_google_glog//:glog",
288 ],
289)
290
Austin Schuhcb108412019-10-13 16:09:54 -0700291flatbuffer_cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700292 name = "configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700293 srcs = ["configuration.fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700294 visibility = ["//visibility:public"],
Austin Schuhcb108412019-10-13 16:09:54 -0700295)
296
John Park398c74a2018-10-20 21:17:39 -0700297cc_library(
298 name = "configuration",
299 srcs = [
300 "configuration.cc",
301 ],
302 hdrs = [
303 "configuration.h",
304 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800305 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700306 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700307 ":configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700308 ":flatbuffer_merge",
309 ":flatbuffers",
310 ":json_to_flatbuffer",
John Park398c74a2018-10-20 21:17:39 -0700311 "//aos:unique_malloc_ptr",
Austin Schuhcb108412019-10-13 16:09:54 -0700312 "//aos/util:file",
313 "@com_github_google_glog//:glog",
James Kuszmaul872efd22019-12-03 20:59:09 -0800314 "@com_google_absl//absl/base",
Austin Schuhcb108412019-10-13 16:09:54 -0700315 "@com_google_absl//absl/container:btree",
316 "@com_google_absl//absl/strings",
John Park398c74a2018-10-20 21:17:39 -0700317 ],
John Park398c74a2018-10-20 21:17:39 -0700318)
319
320cc_binary(
321 name = "core",
322 srcs = [
323 "core.cc",
324 ],
325 deps = [
326 ":init",
327 "//aos/util:run_command",
328 ],
329)
Brian Silvermanf819b442019-01-20 16:51:04 -0800330
331cc_library(
332 name = "make_unique",
333 hdrs = [
334 "make_unique.h",
335 ],
336 visibility = ["//visibility:public"],
337)
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700338
339flatbuffer_cc_library(
340 name = "json_to_flatbuffer_flatbuffer",
341 srcs = ["json_to_flatbuffer.fbs"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800342 gen_reflections = 1,
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700343)
344
345cc_library(
Austin Schuh43c6a352019-09-30 22:22:10 -0700346 name = "flatbuffer_utils",
347 srcs = ["flatbuffer_utils.cc"],
348 hdrs = ["flatbuffer_utils.h"],
349 deps = [
350 "@com_github_google_flatbuffers//:flatbuffers",
351 ],
352)
353
354cc_library(
Austin Schuhd7e252d2019-10-06 13:51:02 -0700355 name = "json_tokenizer",
356 srcs = ["json_tokenizer.cc"],
357 hdrs = ["json_tokenizer.h"],
358 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700359 "@com_github_google_glog//:glog",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700360 "@com_google_absl//absl/strings",
361 ],
362)
363
364cc_library(
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700365 name = "json_to_flatbuffer",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800366 srcs = [
367 "flatbuffer_introspection.cc",
368 "json_to_flatbuffer.cc",
369 ],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700370 hdrs = ["json_to_flatbuffer.h"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700371 visibility = ["//visibility:public"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700372 deps = [
Austin Schuh43c6a352019-09-30 22:22:10 -0700373 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700374 ":flatbuffers",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700375 ":json_tokenizer",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700376 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuhe93d8642019-10-13 15:27:07 -0700377 "@com_github_google_glog//:glog",
Austin Schuhd339a9b2019-10-05 21:33:32 -0700378 "@com_google_absl//absl/strings",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700379 ],
380)
381
382cc_test(
383 name = "json_to_flatbuffer_test",
384 srcs = [
385 "json_to_flatbuffer_test.cc",
386 ],
387 deps = [
388 ":json_to_flatbuffer",
389 ":json_to_flatbuffer_flatbuffer",
390 "//aos/testing:googletest",
391 ],
392)
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700393
Tyler Chatow5e369a42019-11-23 11:57:31 -0800394cc_test(
395 name = "flatbuffer_introspection_test",
396 srcs = [
397 "flatbuffer_introspection_test.cc",
398 ],
399 data = [
400 ":json_to_flatbuffer_flatbuffer_reflection_out",
401 ],
402 deps = [
403 ":json_to_flatbuffer",
404 ":json_to_flatbuffer_flatbuffer",
405 "//aos/testing:googletest",
406 "//aos/util:file",
407 "@com_github_google_flatbuffers//:flatbuffers",
408 ],
409)
410
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700411cc_library(
412 name = "flatbuffer_merge",
413 srcs = ["flatbuffer_merge.cc"],
414 hdrs = ["flatbuffer_merge.h"],
415 copts = ["-Wno-cast-align"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700416 visibility = ["//visibility:public"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700417 deps = [
418 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700419 ":flatbuffers",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700420 "@com_github_google_flatbuffers//:flatbuffers",
421 ],
422)
423
424cc_test(
425 name = "flatbuffer_merge_test",
426 srcs = [
427 "flatbuffer_merge_test.cc",
428 ],
429 deps = [
430 ":flatbuffer_merge",
431 ":json_to_flatbuffer",
432 ":json_to_flatbuffer_flatbuffer",
433 "//aos/testing:googletest",
434 ],
435)
Austin Schuhe93d8642019-10-13 15:27:07 -0700436
437cc_library(
438 name = "flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700439 srcs = [
440 "flatbuffers.cc",
441 ],
Austin Schuhe93d8642019-10-13 15:27:07 -0700442 hdrs = [
443 "flatbuffers.h",
444 ],
Austin Schuh40485ed2019-10-26 21:51:44 -0700445 visibility = ["//visibility:public"],
Austin Schuhe93d8642019-10-13 15:27:07 -0700446 deps = [
447 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700448 "@com_github_google_glog//:glog",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700449 "@com_google_absl//absl/strings",
Austin Schuhe93d8642019-10-13 15:27:07 -0700450 ],
451)
Austin Schuhcb108412019-10-13 16:09:54 -0700452
453cc_test(
454 name = "configuration_test",
455 srcs = [
456 "configuration_test.cc",
457 ],
458 data = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700459 "testdata/backwards.json",
Austin Schuhcb108412019-10-13 16:09:54 -0700460 "testdata/config1.json",
461 "testdata/config1_bad.json",
462 "testdata/config2.json",
463 "testdata/config3.json",
464 "testdata/expected.json",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800465 "//aos/events:pingpong_config.json",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800466 "//aos/events:pong.bfbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700467 ],
468 deps = [
469 ":configuration",
470 "//aos/testing:googletest",
471 "//aos/testing:test_logging",
472 ],
473)
Alex Perrycb7da4b2019-08-28 19:35:56 -0700474
475cc_binary(
476 name = "config_flattener",
477 srcs = [
478 "config_flattener.cc",
479 ],
480 visibility = ["//visibility:public"],
481 deps = [
482 ":configuration",
483 ":init",
484 "//aos/util:file",
485 "@com_github_google_glog//:glog",
486 ],
487)
Tyler Chatow5e369a42019-11-23 11:57:31 -0800488
489cc_binary(
490 name = "log_fbs_shmem",
491 srcs = [
492 "log_fbs_shmem.cc",
493 ],
494 visibility = ["//visibility:public"],
495 deps = [
496 ":configuration",
497 ":json_to_flatbuffer",
498 "//aos:init",
499 "//aos/events:shm_event_loop",
500 "@com_github_google_glog//:glog",
501 ],
502)