blob: ee0aa052bf1ae871b396be4e03e9f656116ddc33 [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 Schuh944df342019-12-21 17:08:55 -08007 "//aos:aos_dump",
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 = [
James Kuszmaul38735e82019-12-07 16:42:06 -080019 "//aos/events/logging:logger_main",
John Park33858a32018-09-28 23:05:48 -070020 "//aos/logging:binary_log_writer",
Brian Silverman6470f442018-08-05 12:08:16 -070021 ],
22 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080023)
Brian Silverman6470f442018-08-05 12:08:16 -070024
Austin Schuhc80dd152016-02-29 01:47:44 -080025filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070026 name = "prime_binaries_stripped",
27 srcs = [
28 # starter is hard coded to look for a non-stripped core...
John Park398c74a2018-10-20 21:17:39 -070029 "//aos:core",
John Park33858a32018-09-28 23:05:48 -070030 "//aos/logging:log_streamer.stripped",
31 "//aos/logging:log_displayer.stripped",
Austin Schuh944df342019-12-21 17:08:55 -080032 "//aos:aos_dump.stripped",
John Park398c74a2018-10-20 21:17:39 -070033 "//aos/starter",
Brian Silverman6470f442018-08-05 12:08:16 -070034 ],
35 visibility = ["//visibility:public"],
36)
37
38filegroup(
39 name = "prime_start_binaries_stripped",
40 srcs = [
James Kuszmaul38735e82019-12-07 16:42:06 -080041 "//aos/events/logging:logger_main.stripped",
John Park33858a32018-09-28 23:05:48 -070042 "//aos/logging:binary_log_writer.stripped",
Brian Silverman6470f442018-08-05 12:08:16 -070043 ],
44 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080045)
Sabina Davis2ed5ea22017-09-26 22:27:42 -070046
47cc_library(
John Park33858a32018-09-28 23:05:48 -070048 name = "math",
49 hdrs = [
50 "commonmath.h",
51 ],
52 compatible_with = mcu_cpus,
53 visibility = ["//visibility:public"],
54)
55
56cc_library(
Brian Silverman6470f442018-08-05 12:08:16 -070057 name = "once",
58 srcs = [
59 "once-tmpl.h",
60 ],
61 hdrs = [
62 "once.h",
63 ],
64 visibility = ["//visibility:public"],
65 deps = [
John Park33858a32018-09-28 23:05:48 -070066 "//aos:gtest_prod",
Austin Schuh972e47e2018-12-20 17:20:58 -080067 "//aos/type_traits",
Brian Silverman6470f442018-08-05 12:08:16 -070068 ],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070069)
Brian Silverman6470f442018-08-05 12:08:16 -070070
John Park33858a32018-09-28 23:05:48 -070071cc_library(
72 name = "byteorder",
73 hdrs = [
74 "byteorder.h",
75 ],
John Park33858a32018-09-28 23:05:48 -070076 visibility = ["//visibility:public"],
77)
78
Sabina Davis2ed5ea22017-09-26 22:27:42 -070079cc_test(
Brian Silverman6470f442018-08-05 12:08:16 -070080 name = "once_test",
81 srcs = [
82 "once_test.cc",
83 ],
84 visibility = ["//visibility:public"],
85 deps = [
86 "//aos:once",
87 "//aos/testing:googletest",
88 ],
89)
90
91py_library(
92 name = "python_init",
93 srcs = ["__init__.py"],
94 visibility = ["//visibility:public"],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070095)
John Park33858a32018-09-28 23:05:48 -070096
97cc_library(
Austin Schuh972e47e2018-12-20 17:20:58 -080098 name = "macros",
99 hdrs = [
John Park33858a32018-09-28 23:05:48 -0700100 "macros.h",
John Park33858a32018-09-28 23:05:48 -0700101 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800102 compatible_with = mcu_cpus,
John Park33858a32018-09-28 23:05:48 -0700103 visibility = ["//visibility:public"],
104)
105
106cc_library(
107 name = "gtest_prod",
108 hdrs = [
109 "gtest_prod.h",
110 ],
John Park33858a32018-09-28 23:05:48 -0700111 visibility = ["//visibility:public"],
112)
113
114cc_library(
115 name = "network_port",
116 hdrs = [
117 "network_port.h",
118 ],
119 visibility = ["//visibility:public"],
120)
121
John Park33858a32018-09-28 23:05:48 -0700122cc_library(
123 name = "unique_malloc_ptr",
124 hdrs = [
125 "unique_malloc_ptr.h",
126 ],
John Park33858a32018-09-28 23:05:48 -0700127 visibility = ["//visibility:public"],
128)
129
130cc_library(
131 name = "condition",
132 srcs = [
133 "condition.cc",
134 ],
135 hdrs = [
136 "condition.h",
137 ],
John Park33858a32018-09-28 23:05:48 -0700138 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800139 deps = [
140 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800141 "//aos/mutex",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700142 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800143 ],
John Park33858a32018-09-28 23:05:48 -0700144)
145
146cc_test(
147 name = "condition_test",
148 srcs = [
149 "condition_test.cc",
150 ],
151 deps = [
152 ":condition",
153 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700154 "//aos/ipc_lib:aos_sync",
155 "//aos/ipc_lib:core_lib",
Austin Schuh972e47e2018-12-20 17:20:58 -0800156 "//aos/logging",
157 "//aos/mutex",
John Park33858a32018-09-28 23:05:48 -0700158 "//aos/testing:googletest",
159 "//aos/testing:prevent_exit",
160 "//aos/testing:test_shm",
Austin Schuh972e47e2018-12-20 17:20:58 -0800161 "//aos/time",
162 "//aos/util:thread",
John Park33858a32018-09-28 23:05:48 -0700163 ],
164)
165
166cc_library(
167 name = "die",
168 srcs = [
169 "die.cc",
170 ],
171 hdrs = [
172 "die.h",
173 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800174 visibility = ["//visibility:public"],
John Park33858a32018-09-28 23:05:48 -0700175 deps = [
176 "//aos:macros",
177 "//aos/libc:aos_strerror",
178 ],
John Park33858a32018-09-28 23:05:48 -0700179)
180
John Park33858a32018-09-28 23:05:48 -0700181cc_test(
182 name = "die_test",
183 srcs = [
184 "die_test.cc",
185 ],
186 deps = [
187 ":die",
188 "//aos/testing:googletest",
189 ],
190)
191
192cc_library(
193 name = "event",
194 srcs = [
195 "event.cc",
196 ],
197 hdrs = [
198 "event.h",
199 ],
John Park33858a32018-09-28 23:05:48 -0700200 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800201 deps = [
202 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800203 "//aos/time",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700204 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800205 ],
John Park33858a32018-09-28 23:05:48 -0700206)
207
208cc_test(
209 name = "event_test",
210 srcs = [
211 "event_test.cc",
Austin Schuh972e47e2018-12-20 17:20:58 -0800212 ],
John Park33858a32018-09-28 23:05:48 -0700213 deps = [
214 ":event",
John Park33858a32018-09-28 23:05:48 -0700215 "//aos/testing:googletest",
216 "//aos/testing:test_logging",
Austin Schuh972e47e2018-12-20 17:20:58 -0800217 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700218 ],
219)
John Park398c74a2018-10-20 21:17:39 -0700220
221cc_binary(
222 name = "dump_rtprio",
223 srcs = [
224 "dump_rtprio.cc",
225 ],
226 deps = [
John Park398c74a2018-10-20 21:17:39 -0700227 "//aos/logging",
228 "//aos/logging:implementations",
Austin Schuh972e47e2018-12-20 17:20:58 -0800229 "//aos/time",
John Park398c74a2018-10-20 21:17:39 -0700230 ],
231)
232
233cc_library(
John Park398c74a2018-10-20 21:17:39 -0700234 name = "complex_thread_local",
235 srcs = [
236 "complex_thread_local.cc",
237 ],
238 hdrs = [
239 "complex_thread_local.h",
240 ],
John Park398c74a2018-10-20 21:17:39 -0700241 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800242 deps = [
243 "//aos:die",
244 "//aos:once",
245 ],
John Park398c74a2018-10-20 21:17:39 -0700246)
247
248cc_test(
249 name = "complex_thread_local_test",
250 srcs = [
251 "complex_thread_local_test.cc",
252 ],
253 deps = [
254 ":complex_thread_local",
255 "//aos/logging",
John Park398c74a2018-10-20 21:17:39 -0700256 "//aos/testing:googletest",
Austin Schuh972e47e2018-12-20 17:20:58 -0800257 "//aos/util:thread",
John Park398c74a2018-10-20 21:17:39 -0700258 ],
259)
260
261cc_library(
262 name = "init",
263 srcs = [
264 "init.cc",
265 ],
266 hdrs = [
267 "init.h",
268 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800269 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700270 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700271 ":realtime",
John Park398c74a2018-10-20 21:17:39 -0700272 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700273 "//aos/ipc_lib:shared_mem",
Austin Schuh972e47e2018-12-20 17:20:58 -0800274 "//aos/logging:implementations",
John Park398c74a2018-10-20 21:17:39 -0700275 ],
John Park398c74a2018-10-20 21:17:39 -0700276)
277
Alex Perrycb7da4b2019-08-28 19:35:56 -0700278cc_library(
279 name = "realtime",
280 srcs = [
281 "realtime.cc",
282 ],
283 hdrs = [
284 "realtime.h",
285 ],
286 visibility = ["//visibility:public"],
287 deps = [
288 "@com_github_google_glog//:glog",
289 ],
290)
291
Austin Schuhcb108412019-10-13 16:09:54 -0700292flatbuffer_cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700293 name = "configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700294 srcs = ["configuration.fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700295 visibility = ["//visibility:public"],
Austin Schuhcb108412019-10-13 16:09:54 -0700296)
297
John Park398c74a2018-10-20 21:17:39 -0700298cc_library(
299 name = "configuration",
300 srcs = [
301 "configuration.cc",
302 ],
303 hdrs = [
304 "configuration.h",
305 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800306 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700307 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700308 ":configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700309 ":flatbuffer_merge",
310 ":flatbuffers",
311 ":json_to_flatbuffer",
John Park398c74a2018-10-20 21:17:39 -0700312 "//aos:unique_malloc_ptr",
Austin Schuhcb108412019-10-13 16:09:54 -0700313 "//aos/util:file",
314 "@com_github_google_glog//:glog",
James Kuszmaul872efd22019-12-03 20:59:09 -0800315 "@com_google_absl//absl/base",
Austin Schuhcb108412019-10-13 16:09:54 -0700316 "@com_google_absl//absl/container:btree",
317 "@com_google_absl//absl/strings",
John Park398c74a2018-10-20 21:17:39 -0700318 ],
John Park398c74a2018-10-20 21:17:39 -0700319)
320
321cc_binary(
322 name = "core",
323 srcs = [
324 "core.cc",
325 ],
326 deps = [
327 ":init",
328 "//aos/util:run_command",
329 ],
330)
Brian Silvermanf819b442019-01-20 16:51:04 -0800331
332cc_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
340flatbuffer_cc_library(
341 name = "json_to_flatbuffer_flatbuffer",
342 srcs = ["json_to_flatbuffer.fbs"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800343 gen_reflections = 1,
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700344)
345
346cc_library(
Austin Schuh43c6a352019-09-30 22:22:10 -0700347 name = "flatbuffer_utils",
348 srcs = ["flatbuffer_utils.cc"],
349 hdrs = ["flatbuffer_utils.h"],
350 deps = [
351 "@com_github_google_flatbuffers//:flatbuffers",
352 ],
353)
354
355cc_library(
Austin Schuhd7e252d2019-10-06 13:51:02 -0700356 name = "json_tokenizer",
357 srcs = ["json_tokenizer.cc"],
358 hdrs = ["json_tokenizer.h"],
359 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700360 "@com_github_google_glog//:glog",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700361 "@com_google_absl//absl/strings",
362 ],
363)
364
365cc_library(
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700366 name = "json_to_flatbuffer",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800367 srcs = [
368 "flatbuffer_introspection.cc",
369 "json_to_flatbuffer.cc",
370 ],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700371 hdrs = ["json_to_flatbuffer.h"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700372 visibility = ["//visibility:public"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700373 deps = [
Austin Schuh43c6a352019-09-30 22:22:10 -0700374 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700375 ":flatbuffers",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700376 ":json_tokenizer",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700377 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuhe93d8642019-10-13 15:27:07 -0700378 "@com_github_google_glog//:glog",
Austin Schuhd339a9b2019-10-05 21:33:32 -0700379 "@com_google_absl//absl/strings",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700380 ],
381)
382
383cc_test(
384 name = "json_to_flatbuffer_test",
385 srcs = [
386 "json_to_flatbuffer_test.cc",
387 ],
388 deps = [
389 ":json_to_flatbuffer",
390 ":json_to_flatbuffer_flatbuffer",
391 "//aos/testing:googletest",
392 ],
393)
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700394
Tyler Chatow5e369a42019-11-23 11:57:31 -0800395cc_test(
396 name = "flatbuffer_introspection_test",
397 srcs = [
398 "flatbuffer_introspection_test.cc",
399 ],
400 data = [
401 ":json_to_flatbuffer_flatbuffer_reflection_out",
402 ],
403 deps = [
404 ":json_to_flatbuffer",
405 ":json_to_flatbuffer_flatbuffer",
406 "//aos/testing:googletest",
407 "//aos/util:file",
408 "@com_github_google_flatbuffers//:flatbuffers",
409 ],
410)
411
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700412cc_library(
413 name = "flatbuffer_merge",
414 srcs = ["flatbuffer_merge.cc"],
415 hdrs = ["flatbuffer_merge.h"],
416 copts = ["-Wno-cast-align"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700417 visibility = ["//visibility:public"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700418 deps = [
419 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700420 ":flatbuffers",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700421 "@com_github_google_flatbuffers//:flatbuffers",
422 ],
423)
424
425cc_test(
426 name = "flatbuffer_merge_test",
427 srcs = [
428 "flatbuffer_merge_test.cc",
429 ],
430 deps = [
431 ":flatbuffer_merge",
432 ":json_to_flatbuffer",
433 ":json_to_flatbuffer_flatbuffer",
434 "//aos/testing:googletest",
435 ],
436)
Austin Schuhe93d8642019-10-13 15:27:07 -0700437
438cc_library(
439 name = "flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700440 srcs = [
441 "flatbuffers.cc",
442 ],
Austin Schuhe93d8642019-10-13 15:27:07 -0700443 hdrs = [
444 "flatbuffers.h",
445 ],
Austin Schuh40485ed2019-10-26 21:51:44 -0700446 visibility = ["//visibility:public"],
Austin Schuhe93d8642019-10-13 15:27:07 -0700447 deps = [
448 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700449 "@com_github_google_glog//:glog",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700450 "@com_google_absl//absl/strings",
Austin Schuhe93d8642019-10-13 15:27:07 -0700451 ],
452)
Austin Schuhcb108412019-10-13 16:09:54 -0700453
454cc_test(
455 name = "configuration_test",
456 srcs = [
457 "configuration_test.cc",
458 ],
459 data = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700460 "testdata/backwards.json",
Austin Schuhcb108412019-10-13 16:09:54 -0700461 "testdata/config1.json",
462 "testdata/config1_bad.json",
463 "testdata/config2.json",
464 "testdata/config3.json",
465 "testdata/expected.json",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800466 "//aos/events:pingpong_config.json",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800467 "//aos/events:pong.bfbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700468 ],
469 deps = [
470 ":configuration",
471 "//aos/testing:googletest",
472 "//aos/testing:test_logging",
473 ],
474)
Alex Perrycb7da4b2019-08-28 19:35:56 -0700475
476cc_binary(
477 name = "config_flattener",
478 srcs = [
479 "config_flattener.cc",
480 ],
481 visibility = ["//visibility:public"],
482 deps = [
483 ":configuration",
484 ":init",
485 "//aos/util:file",
486 "@com_github_google_glog//:glog",
487 ],
488)
Tyler Chatow5e369a42019-11-23 11:57:31 -0800489
490cc_binary(
Austin Schuh944df342019-12-21 17:08:55 -0800491 name = "aos_dump",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800492 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -0800493 "aos_dump.cc",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800494 ],
495 visibility = ["//visibility:public"],
496 deps = [
497 ":configuration",
498 ":json_to_flatbuffer",
499 "//aos:init",
500 "//aos/events:shm_event_loop",
501 "@com_github_google_glog//:glog",
502 ],
503)