blob: 57c6b1ed9f90393de77b95c145693a575e0434d1 [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",
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 = [
James Kuszmaul38735e82019-12-07 16:42:06 -080039 "//aos/events/logging:logger_main.stripped",
John Park33858a32018-09-28 23:05:48 -070040 "//aos/logging:binary_log_writer.stripped",
Brian Silverman6470f442018-08-05 12:08:16 -070041 ],
42 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080043)
Sabina Davis2ed5ea22017-09-26 22:27:42 -070044
45cc_library(
John Park33858a32018-09-28 23:05:48 -070046 name = "math",
47 hdrs = [
48 "commonmath.h",
49 ],
50 compatible_with = mcu_cpus,
51 visibility = ["//visibility:public"],
52)
53
54cc_library(
Brian Silverman6470f442018-08-05 12:08:16 -070055 name = "once",
56 srcs = [
57 "once-tmpl.h",
58 ],
59 hdrs = [
60 "once.h",
61 ],
62 visibility = ["//visibility:public"],
63 deps = [
John Park33858a32018-09-28 23:05:48 -070064 "//aos:gtest_prod",
Austin Schuh972e47e2018-12-20 17:20:58 -080065 "//aos/type_traits",
Brian Silverman6470f442018-08-05 12:08:16 -070066 ],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070067)
Brian Silverman6470f442018-08-05 12:08:16 -070068
John Park33858a32018-09-28 23:05:48 -070069cc_library(
70 name = "byteorder",
71 hdrs = [
72 "byteorder.h",
73 ],
John Park33858a32018-09-28 23:05:48 -070074 visibility = ["//visibility:public"],
75)
76
Sabina Davis2ed5ea22017-09-26 22:27:42 -070077cc_test(
Brian Silverman6470f442018-08-05 12:08:16 -070078 name = "once_test",
79 srcs = [
80 "once_test.cc",
81 ],
82 visibility = ["//visibility:public"],
83 deps = [
84 "//aos:once",
85 "//aos/testing:googletest",
86 ],
87)
88
89py_library(
90 name = "python_init",
91 srcs = ["__init__.py"],
92 visibility = ["//visibility:public"],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070093)
John Park33858a32018-09-28 23:05:48 -070094
95cc_library(
Austin Schuh972e47e2018-12-20 17:20:58 -080096 name = "macros",
97 hdrs = [
John Park33858a32018-09-28 23:05:48 -070098 "macros.h",
John Park33858a32018-09-28 23:05:48 -070099 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800100 compatible_with = mcu_cpus,
John Park33858a32018-09-28 23:05:48 -0700101 visibility = ["//visibility:public"],
102)
103
104cc_library(
105 name = "gtest_prod",
106 hdrs = [
107 "gtest_prod.h",
108 ],
John Park33858a32018-09-28 23:05:48 -0700109 visibility = ["//visibility:public"],
110)
111
112cc_library(
113 name = "network_port",
114 hdrs = [
115 "network_port.h",
116 ],
117 visibility = ["//visibility:public"],
118)
119
John Park33858a32018-09-28 23:05:48 -0700120cc_library(
121 name = "unique_malloc_ptr",
122 hdrs = [
123 "unique_malloc_ptr.h",
124 ],
John Park33858a32018-09-28 23:05:48 -0700125 visibility = ["//visibility:public"],
126)
127
128cc_library(
129 name = "condition",
130 srcs = [
131 "condition.cc",
132 ],
133 hdrs = [
134 "condition.h",
135 ],
John Park33858a32018-09-28 23:05:48 -0700136 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800137 deps = [
138 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800139 "//aos/mutex",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700140 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800141 ],
John Park33858a32018-09-28 23:05:48 -0700142)
143
144cc_test(
145 name = "condition_test",
146 srcs = [
147 "condition_test.cc",
148 ],
149 deps = [
150 ":condition",
151 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700152 "//aos/ipc_lib:aos_sync",
153 "//aos/ipc_lib:core_lib",
Austin Schuh972e47e2018-12-20 17:20:58 -0800154 "//aos/logging",
155 "//aos/mutex",
John Park33858a32018-09-28 23:05:48 -0700156 "//aos/testing:googletest",
157 "//aos/testing:prevent_exit",
158 "//aos/testing:test_shm",
Austin Schuh972e47e2018-12-20 17:20:58 -0800159 "//aos/time",
160 "//aos/util:thread",
John Park33858a32018-09-28 23:05:48 -0700161 ],
162)
163
164cc_library(
165 name = "die",
166 srcs = [
167 "die.cc",
168 ],
169 hdrs = [
170 "die.h",
171 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800172 visibility = ["//visibility:public"],
John Park33858a32018-09-28 23:05:48 -0700173 deps = [
174 "//aos:macros",
175 "//aos/libc:aos_strerror",
176 ],
John Park33858a32018-09-28 23:05:48 -0700177)
178
John Park33858a32018-09-28 23:05:48 -0700179cc_test(
180 name = "die_test",
181 srcs = [
182 "die_test.cc",
183 ],
184 deps = [
185 ":die",
186 "//aos/testing:googletest",
187 ],
188)
189
190cc_library(
191 name = "event",
192 srcs = [
193 "event.cc",
194 ],
195 hdrs = [
196 "event.h",
197 ],
John Park33858a32018-09-28 23:05:48 -0700198 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800199 deps = [
200 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800201 "//aos/time",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700202 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800203 ],
John Park33858a32018-09-28 23:05:48 -0700204)
205
206cc_test(
207 name = "event_test",
208 srcs = [
209 "event_test.cc",
Austin Schuh972e47e2018-12-20 17:20:58 -0800210 ],
John Park33858a32018-09-28 23:05:48 -0700211 deps = [
212 ":event",
John Park33858a32018-09-28 23:05:48 -0700213 "//aos/testing:googletest",
214 "//aos/testing:test_logging",
Austin Schuh972e47e2018-12-20 17:20:58 -0800215 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700216 ],
217)
John Park398c74a2018-10-20 21:17:39 -0700218
219cc_binary(
220 name = "dump_rtprio",
221 srcs = [
222 "dump_rtprio.cc",
223 ],
224 deps = [
John Park398c74a2018-10-20 21:17:39 -0700225 "//aos/logging",
226 "//aos/logging:implementations",
Austin Schuh972e47e2018-12-20 17:20:58 -0800227 "//aos/time",
John Park398c74a2018-10-20 21:17:39 -0700228 ],
229)
230
231cc_library(
John Park398c74a2018-10-20 21:17:39 -0700232 name = "complex_thread_local",
233 srcs = [
234 "complex_thread_local.cc",
235 ],
236 hdrs = [
237 "complex_thread_local.h",
238 ],
John Park398c74a2018-10-20 21:17:39 -0700239 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800240 deps = [
241 "//aos:die",
242 "//aos:once",
243 ],
John Park398c74a2018-10-20 21:17:39 -0700244)
245
246cc_test(
247 name = "complex_thread_local_test",
248 srcs = [
249 "complex_thread_local_test.cc",
250 ],
251 deps = [
252 ":complex_thread_local",
253 "//aos/logging",
John Park398c74a2018-10-20 21:17:39 -0700254 "//aos/testing:googletest",
Austin Schuh972e47e2018-12-20 17:20:58 -0800255 "//aos/util:thread",
John Park398c74a2018-10-20 21:17:39 -0700256 ],
257)
258
259cc_library(
260 name = "init",
261 srcs = [
262 "init.cc",
263 ],
264 hdrs = [
265 "init.h",
266 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800267 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700268 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700269 ":realtime",
John Park398c74a2018-10-20 21:17:39 -0700270 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700271 "//aos/ipc_lib:shared_mem",
Austin Schuh972e47e2018-12-20 17:20:58 -0800272 "//aos/logging:implementations",
John Park398c74a2018-10-20 21:17:39 -0700273 ],
John Park398c74a2018-10-20 21:17:39 -0700274)
275
Alex Perrycb7da4b2019-08-28 19:35:56 -0700276cc_library(
277 name = "realtime",
278 srcs = [
279 "realtime.cc",
280 ],
281 hdrs = [
282 "realtime.h",
283 ],
284 visibility = ["//visibility:public"],
285 deps = [
286 "@com_github_google_glog//:glog",
287 ],
288)
289
Austin Schuhcb108412019-10-13 16:09:54 -0700290flatbuffer_cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700291 name = "configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700292 srcs = ["configuration.fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700293 visibility = ["//visibility:public"],
Austin Schuhcb108412019-10-13 16:09:54 -0700294)
295
John Park398c74a2018-10-20 21:17:39 -0700296cc_library(
297 name = "configuration",
298 srcs = [
299 "configuration.cc",
300 ],
301 hdrs = [
302 "configuration.h",
303 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800304 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700305 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700306 ":configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700307 ":flatbuffer_merge",
308 ":flatbuffers",
309 ":json_to_flatbuffer",
John Park398c74a2018-10-20 21:17:39 -0700310 "//aos:unique_malloc_ptr",
Austin Schuhcb108412019-10-13 16:09:54 -0700311 "//aos/util:file",
312 "@com_github_google_glog//:glog",
James Kuszmaul872efd22019-12-03 20:59:09 -0800313 "@com_google_absl//absl/base",
Austin Schuhcb108412019-10-13 16:09:54 -0700314 "@com_google_absl//absl/container:btree",
315 "@com_google_absl//absl/strings",
John Park398c74a2018-10-20 21:17:39 -0700316 ],
John Park398c74a2018-10-20 21:17:39 -0700317)
318
319cc_binary(
320 name = "core",
321 srcs = [
322 "core.cc",
323 ],
324 deps = [
325 ":init",
326 "//aos/util:run_command",
327 ],
328)
Brian Silvermanf819b442019-01-20 16:51:04 -0800329
330cc_library(
331 name = "make_unique",
332 hdrs = [
333 "make_unique.h",
334 ],
335 visibility = ["//visibility:public"],
336)
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700337
338flatbuffer_cc_library(
339 name = "json_to_flatbuffer_flatbuffer",
340 srcs = ["json_to_flatbuffer.fbs"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800341 gen_reflections = 1,
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700342)
343
344cc_library(
Austin Schuh43c6a352019-09-30 22:22:10 -0700345 name = "flatbuffer_utils",
346 srcs = ["flatbuffer_utils.cc"],
347 hdrs = ["flatbuffer_utils.h"],
348 deps = [
349 "@com_github_google_flatbuffers//:flatbuffers",
350 ],
351)
352
353cc_library(
Austin Schuhd7e252d2019-10-06 13:51:02 -0700354 name = "json_tokenizer",
355 srcs = ["json_tokenizer.cc"],
356 hdrs = ["json_tokenizer.h"],
357 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700358 "@com_github_google_glog//:glog",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700359 "@com_google_absl//absl/strings",
360 ],
361)
362
363cc_library(
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700364 name = "json_to_flatbuffer",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800365 srcs = [
366 "flatbuffer_introspection.cc",
367 "json_to_flatbuffer.cc",
368 ],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700369 hdrs = ["json_to_flatbuffer.h"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700370 visibility = ["//visibility:public"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700371 deps = [
Austin Schuh43c6a352019-09-30 22:22:10 -0700372 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700373 ":flatbuffers",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700374 ":json_tokenizer",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700375 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuhe93d8642019-10-13 15:27:07 -0700376 "@com_github_google_glog//:glog",
Austin Schuhd339a9b2019-10-05 21:33:32 -0700377 "@com_google_absl//absl/strings",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700378 ],
379)
380
381cc_test(
382 name = "json_to_flatbuffer_test",
383 srcs = [
384 "json_to_flatbuffer_test.cc",
385 ],
386 deps = [
387 ":json_to_flatbuffer",
388 ":json_to_flatbuffer_flatbuffer",
389 "//aos/testing:googletest",
390 ],
391)
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700392
Tyler Chatow5e369a42019-11-23 11:57:31 -0800393cc_test(
394 name = "flatbuffer_introspection_test",
395 srcs = [
396 "flatbuffer_introspection_test.cc",
397 ],
398 data = [
399 ":json_to_flatbuffer_flatbuffer_reflection_out",
400 ],
401 deps = [
402 ":json_to_flatbuffer",
403 ":json_to_flatbuffer_flatbuffer",
404 "//aos/testing:googletest",
405 "//aos/util:file",
406 "@com_github_google_flatbuffers//:flatbuffers",
407 ],
408)
409
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700410cc_library(
411 name = "flatbuffer_merge",
412 srcs = ["flatbuffer_merge.cc"],
413 hdrs = ["flatbuffer_merge.h"],
414 copts = ["-Wno-cast-align"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700415 visibility = ["//visibility:public"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700416 deps = [
417 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700418 ":flatbuffers",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700419 "@com_github_google_flatbuffers//:flatbuffers",
420 ],
421)
422
423cc_test(
424 name = "flatbuffer_merge_test",
425 srcs = [
426 "flatbuffer_merge_test.cc",
427 ],
428 deps = [
429 ":flatbuffer_merge",
430 ":json_to_flatbuffer",
431 ":json_to_flatbuffer_flatbuffer",
432 "//aos/testing:googletest",
433 ],
434)
Austin Schuhe93d8642019-10-13 15:27:07 -0700435
436cc_library(
437 name = "flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700438 srcs = [
439 "flatbuffers.cc",
440 ],
Austin Schuhe93d8642019-10-13 15:27:07 -0700441 hdrs = [
442 "flatbuffers.h",
443 ],
Austin Schuh40485ed2019-10-26 21:51:44 -0700444 visibility = ["//visibility:public"],
Austin Schuhe93d8642019-10-13 15:27:07 -0700445 deps = [
446 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700447 "@com_github_google_glog//:glog",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700448 "@com_google_absl//absl/strings",
Austin Schuhe93d8642019-10-13 15:27:07 -0700449 ],
450)
Austin Schuhcb108412019-10-13 16:09:54 -0700451
452cc_test(
453 name = "configuration_test",
454 srcs = [
455 "configuration_test.cc",
456 ],
457 data = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700458 "testdata/backwards.json",
Austin Schuhcb108412019-10-13 16:09:54 -0700459 "testdata/config1.json",
460 "testdata/config1_bad.json",
461 "testdata/config2.json",
462 "testdata/config3.json",
463 "testdata/expected.json",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800464 "//aos/events:pingpong_config.json",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800465 "//aos/events:pong.bfbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700466 ],
467 deps = [
468 ":configuration",
469 "//aos/testing:googletest",
470 "//aos/testing:test_logging",
471 ],
472)
Alex Perrycb7da4b2019-08-28 19:35:56 -0700473
474cc_binary(
475 name = "config_flattener",
476 srcs = [
477 "config_flattener.cc",
478 ],
479 visibility = ["//visibility:public"],
480 deps = [
481 ":configuration",
482 ":init",
483 "//aos/util:file",
484 "@com_github_google_glog//:glog",
485 ],
486)
Tyler Chatow5e369a42019-11-23 11:57:31 -0800487
488cc_binary(
489 name = "log_fbs_shmem",
490 srcs = [
491 "log_fbs_shmem.cc",
492 ],
493 visibility = ["//visibility:public"],
494 deps = [
495 ":configuration",
496 ":json_to_flatbuffer",
497 "//aos:init",
498 "//aos/events:shm_event_loop",
499 "@com_github_google_glog//:glog",
500 ],
501)