blob: f6c6182c137903e5abcf39ff1a98a1793e32710a [file] [log] [blame]
John Park33858a32018-09-28 23:05:48 -07001load("//tools:environments.bzl", "mcu_cpus")
James Kuszmaul7daef362019-12-31 18:28:17 -08002load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_python_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",
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",
256 ],
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
James Kuszmaul7daef362019-12-31 18:28:17 -0800296flatbuffer_python_library(
297 name = "configuration_fbs_python",
298 srcs = ["configuration.fbs"],
299 namespace = "aos",
300 tables = [
301 "Configuration",
302 "Channel",
James Kuszmaul84ff3e52020-01-03 19:48:53 -0800303 "Connection",
James Kuszmaul7daef362019-12-31 18:28:17 -0800304 "Map",
305 "Node",
306 ],
307 visibility = ["//visibility:public"],
308)
309
John Park398c74a2018-10-20 21:17:39 -0700310cc_library(
311 name = "configuration",
312 srcs = [
313 "configuration.cc",
314 ],
315 hdrs = [
316 "configuration.h",
317 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800318 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700319 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700320 ":configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700321 ":flatbuffer_merge",
322 ":flatbuffers",
323 ":json_to_flatbuffer",
John Park398c74a2018-10-20 21:17:39 -0700324 "//aos:unique_malloc_ptr",
Austin Schuh217a9782019-12-21 23:02:50 -0800325 "//aos/network:team_number",
Austin Schuhcb108412019-10-13 16:09:54 -0700326 "//aos/util:file",
327 "@com_github_google_glog//:glog",
328 "@com_google_absl//absl/container:btree",
329 "@com_google_absl//absl/strings",
John Park398c74a2018-10-20 21:17:39 -0700330 ],
John Park398c74a2018-10-20 21:17:39 -0700331)
332
333cc_binary(
334 name = "core",
335 srcs = [
336 "core.cc",
337 ],
338 deps = [
339 ":init",
340 "//aos/util:run_command",
341 ],
342)
Brian Silvermanf819b442019-01-20 16:51:04 -0800343
344cc_library(
345 name = "make_unique",
346 hdrs = [
347 "make_unique.h",
348 ],
349 visibility = ["//visibility:public"],
350)
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700351
352flatbuffer_cc_library(
353 name = "json_to_flatbuffer_flatbuffer",
354 srcs = ["json_to_flatbuffer.fbs"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800355 gen_reflections = 1,
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700356)
357
358cc_library(
Austin Schuh43c6a352019-09-30 22:22:10 -0700359 name = "flatbuffer_utils",
360 srcs = ["flatbuffer_utils.cc"],
361 hdrs = ["flatbuffer_utils.h"],
362 deps = [
363 "@com_github_google_flatbuffers//:flatbuffers",
364 ],
365)
366
367cc_library(
Austin Schuhd7e252d2019-10-06 13:51:02 -0700368 name = "json_tokenizer",
369 srcs = ["json_tokenizer.cc"],
370 hdrs = ["json_tokenizer.h"],
371 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700372 "@com_github_google_glog//:glog",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700373 "@com_google_absl//absl/strings",
374 ],
375)
376
377cc_library(
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700378 name = "json_to_flatbuffer",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800379 srcs = [
380 "flatbuffer_introspection.cc",
381 "json_to_flatbuffer.cc",
382 ],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700383 hdrs = ["json_to_flatbuffer.h"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700384 visibility = ["//visibility:public"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700385 deps = [
Austin Schuh43c6a352019-09-30 22:22:10 -0700386 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700387 ":flatbuffers",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700388 ":json_tokenizer",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700389 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuhe93d8642019-10-13 15:27:07 -0700390 "@com_github_google_glog//:glog",
Austin Schuhd339a9b2019-10-05 21:33:32 -0700391 "@com_google_absl//absl/strings",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700392 ],
393)
394
395cc_test(
396 name = "json_to_flatbuffer_test",
397 srcs = [
398 "json_to_flatbuffer_test.cc",
399 ],
400 deps = [
401 ":json_to_flatbuffer",
402 ":json_to_flatbuffer_flatbuffer",
403 "//aos/testing:googletest",
404 ],
405)
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700406
Tyler Chatow5e369a42019-11-23 11:57:31 -0800407cc_test(
408 name = "flatbuffer_introspection_test",
409 srcs = [
410 "flatbuffer_introspection_test.cc",
411 ],
412 data = [
413 ":json_to_flatbuffer_flatbuffer_reflection_out",
414 ],
415 deps = [
416 ":json_to_flatbuffer",
417 ":json_to_flatbuffer_flatbuffer",
418 "//aos/testing:googletest",
419 "//aos/util:file",
420 "@com_github_google_flatbuffers//:flatbuffers",
421 ],
422)
423
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700424cc_library(
425 name = "flatbuffer_merge",
426 srcs = ["flatbuffer_merge.cc"],
427 hdrs = ["flatbuffer_merge.h"],
428 copts = ["-Wno-cast-align"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700429 visibility = ["//visibility:public"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700430 deps = [
431 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700432 ":flatbuffers",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700433 "@com_github_google_flatbuffers//:flatbuffers",
434 ],
435)
436
437cc_test(
438 name = "flatbuffer_merge_test",
439 srcs = [
440 "flatbuffer_merge_test.cc",
441 ],
442 deps = [
443 ":flatbuffer_merge",
444 ":json_to_flatbuffer",
445 ":json_to_flatbuffer_flatbuffer",
446 "//aos/testing:googletest",
447 ],
448)
Austin Schuhe93d8642019-10-13 15:27:07 -0700449
450cc_library(
451 name = "flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700452 srcs = [
453 "flatbuffers.cc",
454 ],
Austin Schuhe93d8642019-10-13 15:27:07 -0700455 hdrs = [
456 "flatbuffers.h",
457 ],
Austin Schuh40485ed2019-10-26 21:51:44 -0700458 visibility = ["//visibility:public"],
Austin Schuhe93d8642019-10-13 15:27:07 -0700459 deps = [
460 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700461 "@com_github_google_glog//:glog",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700462 "@com_google_absl//absl/strings",
Austin Schuh6f3babe2020-01-26 20:34:50 -0800463 "@com_google_absl//absl/types:span",
Tyler Chatow116edf12020-01-26 11:52:39 -0800464 "//aos:macros",
Austin Schuhe93d8642019-10-13 15:27:07 -0700465 ],
466)
Austin Schuhcb108412019-10-13 16:09:54 -0700467
468cc_test(
469 name = "configuration_test",
470 srcs = [
471 "configuration_test.cc",
472 ],
473 data = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700474 "testdata/backwards.json",
Austin Schuhcb108412019-10-13 16:09:54 -0700475 "testdata/config1.json",
476 "testdata/config1_bad.json",
Austin Schuh8e17be92019-12-24 09:32:11 -0800477 "testdata/config1_multinode.json",
Austin Schuhcb108412019-10-13 16:09:54 -0700478 "testdata/config2.json",
Austin Schuh8e17be92019-12-24 09:32:11 -0800479 "testdata/config2_multinode.json",
Austin Schuhcb108412019-10-13 16:09:54 -0700480 "testdata/config3.json",
481 "testdata/expected.json",
Austin Schuh8e17be92019-12-24 09:32:11 -0800482 "testdata/expected_multinode.json",
Austin Schuhbca6cf02019-12-22 17:28:34 -0800483 "testdata/good_multinode.json",
Austin Schuh217a9782019-12-21 23:02:50 -0800484 "testdata/invalid_destination_node.json",
485 "testdata/invalid_nodes.json",
486 "testdata/invalid_source_node.json",
487 "testdata/self_forward.json",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800488 "//aos/events:pingpong_config.json",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800489 "//aos/events:pong.bfbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700490 ],
491 deps = [
492 ":configuration",
493 "//aos/testing:googletest",
494 "//aos/testing:test_logging",
495 ],
496)
Alex Perrycb7da4b2019-08-28 19:35:56 -0700497
498cc_binary(
499 name = "config_flattener",
500 srcs = [
501 "config_flattener.cc",
502 ],
503 visibility = ["//visibility:public"],
504 deps = [
505 ":configuration",
506 ":init",
507 "//aos/util:file",
508 "@com_github_google_glog//:glog",
509 ],
510)
Tyler Chatow5e369a42019-11-23 11:57:31 -0800511
512cc_binary(
Austin Schuh944df342019-12-21 17:08:55 -0800513 name = "aos_dump",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800514 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -0800515 "aos_dump.cc",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800516 ],
517 visibility = ["//visibility:public"],
518 deps = [
519 ":configuration",
520 ":json_to_flatbuffer",
521 "//aos:init",
522 "//aos/events:shm_event_loop",
523 "@com_github_google_glog//:glog",
524 ],
525)