blob: 4f8787355b7fa7bdc0bae6979ff999f085dcfd76 [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 linkopts = [
238 "-lpthread",
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 Park7bca9812019-10-14 21:23:45 -0700311 "@com_google_absl//absl/base",
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",
315 "@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"],
342)
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",
365 srcs = ["json_to_flatbuffer.cc"],
366 hdrs = ["json_to_flatbuffer.h"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700367 visibility = ["//visibility:public"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700368 deps = [
Austin Schuh43c6a352019-09-30 22:22:10 -0700369 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700370 ":flatbuffers",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700371 ":json_tokenizer",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700372 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuhe93d8642019-10-13 15:27:07 -0700373 "@com_github_google_glog//:glog",
Austin Schuhd339a9b2019-10-05 21:33:32 -0700374 "@com_google_absl//absl/strings",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700375 ],
376)
377
378cc_test(
379 name = "json_to_flatbuffer_test",
380 srcs = [
381 "json_to_flatbuffer_test.cc",
382 ],
383 deps = [
384 ":json_to_flatbuffer",
385 ":json_to_flatbuffer_flatbuffer",
386 "//aos/testing:googletest",
387 ],
388)
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700389
390cc_library(
391 name = "flatbuffer_merge",
392 srcs = ["flatbuffer_merge.cc"],
393 hdrs = ["flatbuffer_merge.h"],
394 copts = ["-Wno-cast-align"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700395 visibility = ["//visibility:public"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700396 deps = [
397 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700398 ":flatbuffers",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700399 "@com_github_google_flatbuffers//:flatbuffers",
400 ],
401)
402
403cc_test(
404 name = "flatbuffer_merge_test",
405 srcs = [
406 "flatbuffer_merge_test.cc",
407 ],
408 deps = [
409 ":flatbuffer_merge",
410 ":json_to_flatbuffer",
411 ":json_to_flatbuffer_flatbuffer",
412 "//aos/testing:googletest",
413 ],
414)
Austin Schuhe93d8642019-10-13 15:27:07 -0700415
416cc_library(
417 name = "flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700418 srcs = [
419 "flatbuffers.cc",
420 ],
Austin Schuhe93d8642019-10-13 15:27:07 -0700421 hdrs = [
422 "flatbuffers.h",
423 ],
Austin Schuh40485ed2019-10-26 21:51:44 -0700424 visibility = ["//visibility:public"],
Austin Schuhe93d8642019-10-13 15:27:07 -0700425 deps = [
426 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700427 "@com_github_google_glog//:glog",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700428 "@com_google_absl//absl/strings",
Austin Schuhe93d8642019-10-13 15:27:07 -0700429 ],
430)
Austin Schuhcb108412019-10-13 16:09:54 -0700431
432cc_test(
433 name = "configuration_test",
434 srcs = [
435 "configuration_test.cc",
436 ],
437 data = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700438 "testdata/backwards.json",
Austin Schuhcb108412019-10-13 16:09:54 -0700439 "testdata/config1.json",
440 "testdata/config1_bad.json",
441 "testdata/config2.json",
442 "testdata/config3.json",
443 "testdata/expected.json",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700444 "//aos/events:config.fb.json",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800445 "//aos/events:ping.bfbs",
446 "//aos/events:pong.bfbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700447 ],
448 deps = [
449 ":configuration",
450 "//aos/testing:googletest",
451 "//aos/testing:test_logging",
452 ],
453)
Alex Perrycb7da4b2019-08-28 19:35:56 -0700454
455cc_binary(
456 name = "config_flattener",
457 srcs = [
458 "config_flattener.cc",
459 ],
460 visibility = ["//visibility:public"],
461 deps = [
462 ":configuration",
463 ":init",
464 "//aos/util:file",
465 "@com_github_google_glog//:glog",
466 ],
467)