blob: f534e6e8976f46982c77246d80eb435c22b729a2 [file] [log] [blame]
Austin Schuha1d006e2022-09-14 21:50:42 -07001load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_py_library", "flatbuffer_rust_library")
2load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
Brian Silvermand1805b62022-07-20 20:47:05 -07003load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
James Kuszmaule4aa01d2022-06-28 14:09:02 -07004load("//aos:flatbuffers.bzl", "cc_static_flatbuffer")
Brian Silverman7edd1ce2022-07-23 16:10:54 -07005load("//tools/build_rules:autocxx.bzl", "autocxx_library")
Austin Schuh972e47e2018-12-20 17:20:58 -08006
Austin Schuh00e302a2020-12-21 11:53:30 -08007exports_files(["aos_dump_autocomplete.sh"])
8
Brian Silverman258b9172015-09-19 14:32:57 -04009filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070010 name = "prime_binaries",
11 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -080012 "//aos:aos_dump",
Tyler Chatowe6f5bef2020-10-31 14:22:04 -070013 "//aos:aos_dump_autocomplete.sh",
Brian Silvermanea2c95f2021-02-10 18:10:26 -080014 "//aos:aos_send",
Austin Schuh91d8d062020-11-02 17:11:13 -080015 "//aos/starter",
Brian Silverman6470f442018-08-05 12:08:16 -070016 ],
17 visibility = ["//visibility:public"],
Austin Schuh1eceeb92015-11-08 21:16:06 -080018)
Austin Schuhc80dd152016-02-29 01:47:44 -080019
20filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070021 name = "prime_start_binaries",
22 srcs = [
James Kuszmaul38735e82019-12-07 16:42:06 -080023 "//aos/events/logging:logger_main",
Brian Silverman6470f442018-08-05 12:08:16 -070024 ],
25 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080026)
Brian Silverman6470f442018-08-05 12:08:16 -070027
Austin Schuhc80dd152016-02-29 01:47:44 -080028filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070029 name = "prime_binaries_stripped",
30 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -080031 "//aos:aos_dump.stripped",
Tyler Chatowe6f5bef2020-10-31 14:22:04 -070032 "//aos:aos_dump_autocomplete.sh",
Brian Silvermanea2c95f2021-02-10 18:10:26 -080033 "//aos:aos_send.stripped",
Austin Schuh44e0b142021-10-16 15:51:10 -070034 "//aos/starter:starter_stripped",
Brian Silverman6470f442018-08-05 12:08:16 -070035 ],
36 visibility = ["//visibility:public"],
37)
38
39filegroup(
40 name = "prime_start_binaries_stripped",
41 srcs = [
James Kuszmaul38735e82019-12-07 16:42:06 -080042 "//aos/events/logging:logger_main.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 ],
John Park33858a32018-09-28 23:05:48 -070052 visibility = ["//visibility:public"],
53)
54
Brian Silverman6470f442018-08-05 12:08:16 -070055py_library(
56 name = "python_init",
57 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -080058 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman6470f442018-08-05 12:08:16 -070059 visibility = ["//visibility:public"],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070060)
John Park33858a32018-09-28 23:05:48 -070061
62cc_library(
Austin Schuh972e47e2018-12-20 17:20:58 -080063 name = "macros",
64 hdrs = [
John Park33858a32018-09-28 23:05:48 -070065 "macros.h",
John Park33858a32018-09-28 23:05:48 -070066 ],
67 visibility = ["//visibility:public"],
68)
69
70cc_library(
71 name = "gtest_prod",
72 hdrs = [
73 "gtest_prod.h",
74 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080075 target_compatible_with = ["@platforms//os:linux"],
John Park33858a32018-09-28 23:05:48 -070076 visibility = ["//visibility:public"],
77)
78
79cc_library(
John Park33858a32018-09-28 23:05:48 -070080 name = "unique_malloc_ptr",
81 hdrs = [
82 "unique_malloc_ptr.h",
83 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080084 target_compatible_with = ["@platforms//os:linux"],
John Park33858a32018-09-28 23:05:48 -070085 visibility = ["//visibility:public"],
86)
87
88cc_library(
89 name = "condition",
90 srcs = [
91 "condition.cc",
92 ],
93 hdrs = [
94 "condition.h",
95 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080096 target_compatible_with = ["@platforms//os:linux"],
John Park33858a32018-09-28 23:05:48 -070097 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -080098 deps = [
99 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800100 "//aos/mutex",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700101 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800102 ],
John Park33858a32018-09-28 23:05:48 -0700103)
104
105cc_test(
106 name = "condition_test",
107 srcs = [
108 "condition_test.cc",
109 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800110 target_compatible_with = ["@platforms//os:linux"],
John Park33858a32018-09-28 23:05:48 -0700111 deps = [
112 ":condition",
113 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700114 "//aos/ipc_lib:aos_sync",
115 "//aos/ipc_lib:core_lib",
Austin Schuh972e47e2018-12-20 17:20:58 -0800116 "//aos/logging",
117 "//aos/mutex",
John Park33858a32018-09-28 23:05:48 -0700118 "//aos/testing:googletest",
119 "//aos/testing:prevent_exit",
120 "//aos/testing:test_shm",
Austin Schuh972e47e2018-12-20 17:20:58 -0800121 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700122 ],
123)
124
125cc_library(
126 name = "die",
127 srcs = [
128 "die.cc",
129 ],
130 hdrs = [
131 "die.h",
132 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800133 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800134 visibility = ["//visibility:public"],
John Park33858a32018-09-28 23:05:48 -0700135 deps = [
136 "//aos:macros",
137 "//aos/libc:aos_strerror",
138 ],
John Park33858a32018-09-28 23:05:48 -0700139)
140
John Park33858a32018-09-28 23:05:48 -0700141cc_test(
142 name = "die_test",
143 srcs = [
144 "die_test.cc",
145 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800146 target_compatible_with = ["@platforms//os:linux"],
John Park33858a32018-09-28 23:05:48 -0700147 deps = [
148 ":die",
149 "//aos/testing:googletest",
150 ],
151)
152
John Park398c74a2018-10-20 21:17:39 -0700153cc_binary(
154 name = "dump_rtprio",
155 srcs = [
156 "dump_rtprio.cc",
157 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800158 target_compatible_with = ["@platforms//os:linux"],
John Park398c74a2018-10-20 21:17:39 -0700159 deps = [
Austin Schuh14056182023-01-03 21:19:38 -0800160 "//aos:init",
161 "//aos/events:shm_event_loop",
Austin Schuh972e47e2018-12-20 17:20:58 -0800162 "//aos/time",
Austin Schuh14056182023-01-03 21:19:38 -0800163 "//aos/util:top",
Brian Silverman3eb60d22021-11-04 19:06:47 -0700164 "@com_github_google_glog//:glog",
John Park398c74a2018-10-20 21:17:39 -0700165 ],
166)
167
168cc_library(
John Park398c74a2018-10-20 21:17:39 -0700169 name = "init",
170 srcs = [
171 "init.cc",
172 ],
173 hdrs = [
174 "init.h",
175 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800176 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800177 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700178 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700179 ":realtime",
James Kuszmaula791b762023-07-13 14:56:21 -0700180 ":uuid",
John Park398c74a2018-10-20 21:17:39 -0700181 "//aos:die",
Austin Schuh972e47e2018-12-20 17:20:58 -0800182 "//aos/logging:implementations",
John Park398c74a2018-10-20 21:17:39 -0700183 ],
John Park398c74a2018-10-20 21:17:39 -0700184)
185
Brian Silvermane4c79ce2022-08-15 05:57:28 -0700186autocxx_library(
187 name = "init_rs",
188 srcs = ["init.rs"],
189 crate_name = "aos_init",
190 libs = [
191 ":init",
192 ],
193 override_cc_toolchain = "@llvm_toolchain//:cc-clang-x86_64-linux",
Austin Schuhdfa127f2022-10-26 21:17:42 -0700194 target_compatible_with = select({
195 "//conditions:default": ["//tools/platforms/rust:has_support"],
196 "//tools:has_msan": ["@platforms//:incompatible"],
197 }),
Brian Silvermane4c79ce2022-08-15 05:57:28 -0700198 visibility = ["//visibility:public"],
199)
200
Alex Perrycb7da4b2019-08-28 19:35:56 -0700201cc_library(
202 name = "realtime",
203 srcs = [
204 "realtime.cc",
205 ],
206 hdrs = [
207 "realtime.h",
208 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800209 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700210 visibility = ["//visibility:public"],
211 deps = [
Austin Schuhcc6070c2020-10-10 20:25:56 -0700212 ":thread_local",
James Kuszmaula791b762023-07-13 14:56:21 -0700213 ":uuid",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700214 "@com_github_google_glog//:glog",
215 ],
216)
217
Austin Schuhcb108412019-10-13 16:09:54 -0700218flatbuffer_cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700219 name = "configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700220 srcs = ["configuration.fbs"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700221 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800222 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700223 visibility = ["//visibility:public"],
Austin Schuhcb108412019-10-13 16:09:54 -0700224)
225
James Kuszmaule4aa01d2022-06-28 14:09:02 -0700226cc_static_flatbuffer(
227 name = "configuration_schema",
228 function = "aos::ConfigurationSchema",
229 target = ":configuration_fbs_reflection_out",
230 visibility = ["//visibility:public"],
231)
232
Alex Perryd5e13572020-02-22 15:15:08 -0800233flatbuffer_ts_library(
234 name = "configuration_ts_fbs",
235 srcs = ["configuration.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800236 target_compatible_with = ["@platforms//os:linux"],
Alex Perryd5e13572020-02-22 15:15:08 -0800237 visibility = ["//visibility:public"],
238)
239
Brian Silverman28760272020-02-02 13:21:51 -0800240flatbuffer_py_library(
James Kuszmaul7daef362019-12-31 18:28:17 -0800241 name = "configuration_fbs_python",
242 srcs = ["configuration.fbs"],
243 namespace = "aos",
244 tables = [
245 "Configuration",
246 "Channel",
James Kuszmaul84ff3e52020-01-03 19:48:53 -0800247 "Connection",
James Kuszmaul7daef362019-12-31 18:28:17 -0800248 "Map",
249 "Node",
250 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800251 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul7daef362019-12-31 18:28:17 -0800252 visibility = ["//visibility:public"],
253)
254
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700255flatbuffer_rust_library(
256 name = "configuration_rust_fbs",
257 srcs = ["configuration.fbs"],
258 crate_name = "aos_configuration_fbs",
Austin Schuhdfa127f2022-10-26 21:17:42 -0700259 target_compatible_with = select({
260 "//conditions:default": ["//tools/platforms/rust:has_support"],
261 "//tools:has_msan": ["@platforms//:incompatible"],
262 }),
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700263 visibility = ["//visibility:public"],
264)
265
John Park398c74a2018-10-20 21:17:39 -0700266cc_library(
267 name = "configuration",
268 srcs = [
269 "configuration.cc",
270 ],
271 hdrs = [
272 "configuration.h",
273 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800274 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800275 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700276 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700277 ":configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700278 ":flatbuffer_merge",
279 ":flatbuffers",
280 ":json_to_flatbuffer",
John Park398c74a2018-10-20 21:17:39 -0700281 "//aos:unique_malloc_ptr",
Austin Schuh83cbb1e2023-06-23 12:59:02 -0700282 "//aos/ipc_lib:index",
Austin Schuh217a9782019-12-21 23:02:50 -0800283 "//aos/network:team_number",
Austin Schuhcb108412019-10-13 16:09:54 -0700284 "//aos/util:file",
285 "@com_github_google_glog//:glog",
286 "@com_google_absl//absl/container:btree",
287 "@com_google_absl//absl/strings",
John Park398c74a2018-10-20 21:17:39 -0700288 ],
John Park398c74a2018-10-20 21:17:39 -0700289)
290
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700291cc_library(
292 name = "configuration_for_rust",
293 srcs = [
294 "configuration_for_rust.cc",
295 ],
296 hdrs = [
297 "configuration_for_rust.h",
298 ],
299 deps = [
300 ":configuration",
301 ":for_rust",
Adam Snaider770b97b2023-08-04 21:07:48 -0700302 "@crate_index//:cxx_cc",
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700303 ],
304)
305
306autocxx_library(
307 name = "configuration_rs",
308 srcs = ["configuration.rs"],
309 crate_name = "aos_configuration",
310 libs = [
311 ":configuration",
312 ":configuration_for_rust",
313 ":configuration_fbs",
314 ],
315 override_cc_toolchain = "@llvm_toolchain//:cc-clang-x86_64-linux",
Austin Schuhdfa127f2022-10-26 21:17:42 -0700316 target_compatible_with = select({
317 "//conditions:default": ["//tools/platforms/rust:has_support"],
318 "//tools:has_msan": ["@platforms//:incompatible"],
319 }),
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700320 visibility = ["//visibility:public"],
321 deps = [
322 ":configuration_rust_fbs",
323 ":flatbuffers_rs",
Adam Snaider770b97b2023-08-04 21:07:48 -0700324 "@crate_index//:thiserror",
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700325 ],
326)
327
328rust_test(
329 name = "configuration_rs_test",
330 crate = ":configuration_rs",
331 data = [
332 "//aos/testdata:test_configs",
333 ],
334 # TODO: Make Rust play happy with pic vs nopic. Details at:
335 # https://github.com/bazelbuild/rules_rust/issues/118
336 rustc_flags = ["-Crelocation-model=static"],
337)
338
James Kuszmaulabb77132020-08-01 19:56:16 -0700339flatbuffer_ts_library(
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800340 name = "json_to_flatbuffer_fbs_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -0700341 srcs = ["json_to_flatbuffer.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800342 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700343 visibility = ["//aos:__subpackages__"],
344)
345
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700346flatbuffer_cc_library(
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800347 name = "json_to_flatbuffer_fbs",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700348 srcs = ["json_to_flatbuffer.fbs"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800349 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800350 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700351 visibility = ["//aos:__subpackages__"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700352)
353
Brian Silvermand1805b62022-07-20 20:47:05 -0700354flatbuffer_rust_library(
355 name = "json_to_flatbuffer_rust_fbs",
356 srcs = ["json_to_flatbuffer.fbs"],
357 crate_name = "aos_json_to_flatbuffer_fbs",
Austin Schuhdfa127f2022-10-26 21:17:42 -0700358 target_compatible_with = select({
359 "//conditions:default": ["//tools/platforms/rust:has_support"],
360 "//tools:has_msan": ["@platforms//:incompatible"],
361 }),
Brian Silvermand1805b62022-07-20 20:47:05 -0700362 visibility = ["//aos:__subpackages__"],
363)
364
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700365cc_library(
Austin Schuh43c6a352019-09-30 22:22:10 -0700366 name = "flatbuffer_utils",
367 srcs = ["flatbuffer_utils.cc"],
368 hdrs = ["flatbuffer_utils.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800369 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul4ed5fb12022-03-22 15:20:04 -0700370 visibility = ["//visibility:public"],
Austin Schuh43c6a352019-09-30 22:22:10 -0700371 deps = [
372 "@com_github_google_flatbuffers//:flatbuffers",
Brian Silvermancf4fb662021-02-10 17:54:53 -0800373 "@com_github_google_glog//:glog",
Austin Schuh43c6a352019-09-30 22:22:10 -0700374 ],
375)
376
377cc_library(
Austin Schuhd7e252d2019-10-06 13:51:02 -0700378 name = "json_tokenizer",
379 srcs = ["json_tokenizer.cc"],
380 hdrs = ["json_tokenizer.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800381 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd7e252d2019-10-06 13:51:02 -0700382 deps = [
Pallavi Madhukare2eb2812022-07-19 09:56:09 -0700383 "@com_github_google_flatbuffers//:flatbuffers",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700384 "@com_github_google_glog//:glog",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700385 "@com_google_absl//absl/strings",
386 ],
387)
388
389cc_library(
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700390 name = "json_to_flatbuffer",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800391 srcs = [
392 "flatbuffer_introspection.cc",
393 "json_to_flatbuffer.cc",
394 ],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700395 hdrs = ["json_to_flatbuffer.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800396 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700397 visibility = ["//visibility:public"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700398 deps = [
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700399 ":fast_string_builder",
Austin Schuh43c6a352019-09-30 22:22:10 -0700400 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700401 ":flatbuffers",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700402 ":json_tokenizer",
Austin Schuhbba10282021-03-20 22:03:28 -0700403 "//aos/util:file",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700404 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuhe93d8642019-10-13 15:27:07 -0700405 "@com_github_google_glog//:glog",
Austin Schuhd339a9b2019-10-05 21:33:32 -0700406 "@com_google_absl//absl/strings",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700407 ],
408)
409
410cc_test(
411 name = "json_to_flatbuffer_test",
412 srcs = [
413 "json_to_flatbuffer_test.cc",
414 ],
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800415 data = [
416 ":json_to_flatbuffer_fbs_reflection_out",
Alexander Yeee61cac32023-02-11 19:40:40 -0800417 ":json_to_flatbuffer_test_spaces.json",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800418 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800419 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700420 deps = [
Alexander Yeee61cac32023-02-11 19:40:40 -0800421 ":flatbuffer_merge",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700422 ":json_to_flatbuffer",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800423 ":json_to_flatbuffer_fbs",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700424 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -0700425 "//aos/testing:path",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700426 ],
427)
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700428
Tyler Chatow5e369a42019-11-23 11:57:31 -0800429cc_test(
430 name = "flatbuffer_introspection_test",
431 srcs = [
432 "flatbuffer_introspection_test.cc",
433 ],
434 data = [
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800435 ":json_to_flatbuffer_fbs_reflection_out",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800436 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800437 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800438 deps = [
439 ":json_to_flatbuffer",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800440 ":json_to_flatbuffer_fbs",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800441 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -0700442 "//aos/testing:path",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800443 "//aos/util:file",
444 "@com_github_google_flatbuffers//:flatbuffers",
445 ],
446)
447
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700448cc_library(
449 name = "flatbuffer_merge",
450 srcs = ["flatbuffer_merge.cc"],
451 hdrs = ["flatbuffer_merge.h"],
452 copts = ["-Wno-cast-align"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800453 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700454 visibility = ["//visibility:public"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700455 deps = [
456 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700457 ":flatbuffers",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700458 "@com_github_google_flatbuffers//:flatbuffers",
459 ],
460)
461
462cc_test(
463 name = "flatbuffer_merge_test",
464 srcs = [
465 "flatbuffer_merge_test.cc",
466 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800467 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700468 deps = [
469 ":flatbuffer_merge",
470 ":json_to_flatbuffer",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800471 ":json_to_flatbuffer_fbs",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700472 "//aos/testing:googletest",
473 ],
474)
Austin Schuhe93d8642019-10-13 15:27:07 -0700475
476cc_library(
477 name = "flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700478 srcs = [
479 "flatbuffers.cc",
480 ],
Austin Schuhe93d8642019-10-13 15:27:07 -0700481 hdrs = [
482 "flatbuffers.h",
483 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800484 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh40485ed2019-10-26 21:51:44 -0700485 visibility = ["//visibility:public"],
Austin Schuhe93d8642019-10-13 15:27:07 -0700486 deps = [
James Kuszmaulad8a8082020-02-14 21:21:58 -0800487 "//aos:macros",
Brian Silverman354697a2020-09-22 21:06:32 -0700488 "//aos/containers:resizeable_buffer",
davidjevans8b9b52f2021-09-17 08:57:30 -0700489 "//aos/util:file",
Austin Schuhe93d8642019-10-13 15:27:07 -0700490 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700491 "@com_github_google_glog//:glog",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700492 "@com_google_absl//absl/strings",
Austin Schuh6f3babe2020-01-26 20:34:50 -0800493 "@com_google_absl//absl/types:span",
Austin Schuhe93d8642019-10-13 15:27:07 -0700494 ],
495)
Austin Schuhcb108412019-10-13 16:09:54 -0700496
Brian Silvermand1805b62022-07-20 20:47:05 -0700497rust_library(
498 name = "flatbuffers_rs",
499 srcs = ["flatbuffers.rs"],
500 crate_name = "aos_flatbuffers",
Austin Schuhdfa127f2022-10-26 21:17:42 -0700501 target_compatible_with = select({
502 "//conditions:default": ["//tools/platforms/rust:has_support"],
503 "//tools:has_msan": ["@platforms//:incompatible"],
504 }),
Brian Silvermand1805b62022-07-20 20:47:05 -0700505 visibility = ["//visibility:public"],
506 deps = [
507 "@com_github_google_flatbuffers//rust",
508 ],
509)
510
511rust_test(
512 name = "flatbuffers_rs_test",
513 crate = ":flatbuffers_rs",
514 deps = [
515 ":json_to_flatbuffer_rust_fbs",
516 ],
517)
518
Austin Schuhcb108412019-10-13 16:09:54 -0700519cc_test(
520 name = "configuration_test",
521 srcs = [
522 "configuration_test.cc",
523 ],
524 data = [
Nathan Leong307c9692022-10-08 15:25:03 -0700525 "//aos/events:ping_fbs_reflection_out",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700526 "//aos/events:pingpong_config",
Brian Silvermandae15a12022-07-23 12:55:20 -0700527 "//aos/events:pong_fbs_reflection_out",
James Kuszmaulc0c08da2020-05-10 18:56:07 -0700528 "//aos/testdata:test_configs",
Austin Schuhcb108412019-10-13 16:09:54 -0700529 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800530 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhcb108412019-10-13 16:09:54 -0700531 deps = [
532 ":configuration",
Nathan Leong307c9692022-10-08 15:25:03 -0700533 "//aos/events:ping_fbs",
Austin Schuh1ef01ef2021-02-07 20:40:36 -0800534 "//aos/testing:flatbuffer_eq",
Austin Schuhcb108412019-10-13 16:09:54 -0700535 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -0700536 "//aos/testing:path",
Austin Schuhcb108412019-10-13 16:09:54 -0700537 "//aos/testing:test_logging",
538 ],
539)
Alex Perrycb7da4b2019-08-28 19:35:56 -0700540
541cc_binary(
542 name = "config_flattener",
543 srcs = [
544 "config_flattener.cc",
545 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800546 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700547 visibility = ["//visibility:public"],
548 deps = [
549 ":configuration",
550 ":init",
551 "//aos/util:file",
552 "@com_github_google_glog//:glog",
553 ],
554)
Tyler Chatow5e369a42019-11-23 11:57:31 -0800555
Brian Silvermanea2c95f2021-02-10 18:10:26 -0800556cc_library(
557 name = "aos_cli_utils",
558 srcs = [
559 "aos_cli_utils.cc",
560 ],
561 hdrs = [
562 "aos_cli_utils.h",
563 ],
564 target_compatible_with = ["@platforms//os:linux"],
565 visibility = ["//visibility:public"],
566 deps = [
567 ":configuration",
568 "//aos:init",
569 "//aos/events:shm_event_loop",
Austin Schuh893d7f42022-09-16 15:01:35 -0700570 "//aos/events:simulated_event_loop",
Brian Silvermanea2c95f2021-02-10 18:10:26 -0800571 "@com_github_google_glog//:glog",
572 ],
573)
574
Tyler Chatow5e369a42019-11-23 11:57:31 -0800575cc_binary(
Austin Schuh944df342019-12-21 17:08:55 -0800576 name = "aos_dump",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800577 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -0800578 "aos_dump.cc",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800579 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800580 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800581 visibility = ["//visibility:public"],
582 deps = [
Brian Silvermanea2c95f2021-02-10 18:10:26 -0800583 ":aos_cli_utils",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800584 ":configuration",
585 ":json_to_flatbuffer",
586 "//aos:init",
Brian Silvermanea2c95f2021-02-10 18:10:26 -0800587 "@com_github_google_glog//:glog",
588 ],
589)
590
591cc_binary(
592 name = "aos_send",
593 srcs = [
594 "aos_send.cc",
595 ],
596 target_compatible_with = ["@platforms//os:linux"],
597 visibility = ["//visibility:public"],
598 deps = [
599 ":aos_cli_utils",
600 ":configuration",
601 ":init",
602 ":json_to_flatbuffer",
603 "@com_github_gflags_gflags//:gflags",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800604 "@com_github_google_glog//:glog",
605 ],
606)
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500607
Jim Ostrowski17ce54d2020-10-24 17:24:01 -0700608cc_binary(
609 name = "aos_graph_nodes",
610 srcs = [
611 "aos_graph_nodes.cc",
612 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800613 target_compatible_with = ["@platforms//os:linux"],
Jim Ostrowski17ce54d2020-10-24 17:24:01 -0700614 visibility = ["//visibility:public"],
615 deps = [
616 ":configuration",
617 ":json_to_flatbuffer",
618 "//aos:init",
619 "//aos/events:shm_event_loop",
620 "@com_github_google_glog//:glog",
621 ],
622)
623
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500624cc_library(
625 name = "ftrace",
626 srcs = [
627 "ftrace.cc",
628 ],
629 hdrs = [
630 "ftrace.h",
631 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800632 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500633 visibility = ["//visibility:public"],
634 deps = [
635 "@com_github_google_glog//:glog",
Austin Schuhc9de0132022-12-26 18:04:53 -0800636 "@com_google_absl//absl/strings",
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500637 ],
638)
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700639
640cc_library(
641 name = "fast_string_builder",
642 srcs = [
643 "fast_string_builder.cc",
644 ],
645 hdrs = [
646 "fast_string_builder.h",
647 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800648 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul4ed5fb12022-03-22 15:20:04 -0700649 visibility = ["//visibility:public"],
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700650 deps = [
651 "@com_github_google_glog//:glog",
652 "@com_google_absl//absl/strings",
653 "@com_google_absl//absl/strings:str_format",
654 ],
655)
Brian Silvermanb47f5552020-10-01 15:08:14 -0700656
657cc_library(
658 name = "thread_local",
659 hdrs = [
660 "thread_local.h",
661 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800662 target_compatible_with = ["@platforms//os:linux"],
Brian Silvermanb47f5552020-10-01 15:08:14 -0700663 visibility = ["//visibility:public"],
664)
Austin Schuhcc6070c2020-10-10 20:25:56 -0700665
666cc_test(
667 name = "realtime_test",
668 srcs = [
669 "realtime_test.cc",
670 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800671 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhcc6070c2020-10-10 20:25:56 -0700672 visibility = ["//visibility:public"],
673 deps = [
Austin Schuh77f3f222022-06-10 16:49:21 -0700674 ":init",
Austin Schuhcc6070c2020-10-10 20:25:56 -0700675 ":realtime",
Austin Schuh77f3f222022-06-10 16:49:21 -0700676 "@com_github_gflags_gflags//:gflags",
677 "@com_github_google_glog//:glog",
678 "@com_google_googletest//:gtest",
Austin Schuhcc6070c2020-10-10 20:25:56 -0700679 ],
680)
Austin Schuh977a5ed2020-12-02 23:20:04 -0800681
682cc_test(
683 name = "flatbuffers_test",
684 srcs = [
685 "flatbuffers_test.cc",
686 ],
687 deps = [
688 ":flatbuffers",
689 ":json_to_flatbuffer",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800690 ":json_to_flatbuffer_fbs",
Austin Schuh977a5ed2020-12-02 23:20:04 -0800691 "//aos/testing:googletest",
davidjevans8b9b52f2021-09-17 08:57:30 -0700692 "//aos/testing:tmpdir",
Austin Schuh977a5ed2020-12-02 23:20:04 -0800693 ],
694)
Austin Schuh0de30f32020-12-06 12:44:28 -0800695
696py_binary(
697 name = "flatbuffers_static",
698 srcs = ["flatbuffers_static.py"],
699 visibility = ["//visibility:public"],
700)
Austin Schuh4385b142021-03-14 21:31:13 -0700701
702cc_library(
703 name = "uuid",
704 srcs = ["uuid.cc"],
705 hdrs = ["uuid.h"],
706 target_compatible_with = ["@platforms//os:linux"],
707 visibility = ["//visibility:public"],
708 deps = [
Austin Schuh81d0fe42022-08-17 16:29:23 -0700709 ":thread_local",
Austin Schuh8902fa52021-03-14 22:39:24 -0700710 "@com_github_gflags_gflags//:gflags",
Austin Schuh4385b142021-03-14 21:31:13 -0700711 "@com_github_google_flatbuffers//:flatbuffers",
712 "@com_github_google_glog//:glog",
713 "@com_google_absl//absl/types:span",
714 ],
715)
716
717cc_test(
James Kuszmaul05ccb272023-07-13 10:58:14 -0700718 name = "uuid_collision_test",
James Kuszmaula791b762023-07-13 14:56:21 -0700719 timeout = "eternal",
James Kuszmaul05ccb272023-07-13 10:58:14 -0700720 srcs = ["uuid_collision_test.cc"],
James Kuszmaula791b762023-07-13 14:56:21 -0700721 shard_count = 2,
James Kuszmaul05ccb272023-07-13 10:58:14 -0700722 target_compatible_with = ["@platforms//os:linux"],
723 deps = [
724 ":uuid",
725 "//aos/testing:googletest",
726 ],
727)
728
729cc_test(
Austin Schuh4385b142021-03-14 21:31:13 -0700730 name = "uuid_test",
731 srcs = ["uuid_test.cc"],
732 target_compatible_with = ["@platforms//os:linux"],
733 deps = [
734 ":uuid",
735 "//aos/testing:googletest",
736 ],
737)
Austin Schuh30f74292021-08-13 17:25:26 -0700738
Brian Silverman10599932022-08-15 06:05:53 -0700739cc_library(
740 name = "uuid_for_rust",
741 hdrs = ["uuid_for_rust.h"],
742 deps = [
743 ":uuid",
744 ],
745)
746
747autocxx_library(
748 name = "uuid_rs",
749 srcs = ["uuid.rs"],
750 crate_name = "aos_uuid",
751 libs = [
752 ":uuid",
753 ":uuid_for_rust",
754 ],
755 override_cc_toolchain = "@llvm_toolchain//:cc-clang-x86_64-linux",
756 rs_deps = [
Adam Snaider770b97b2023-08-04 21:07:48 -0700757 "@crate_index//:uuid",
Brian Silverman10599932022-08-15 06:05:53 -0700758 ],
Austin Schuhdfa127f2022-10-26 21:17:42 -0700759 target_compatible_with = select({
760 "//conditions:default": ["//tools/platforms/rust:has_support"],
761 "//tools:has_msan": ["@platforms//:incompatible"],
762 }),
Brian Silverman10599932022-08-15 06:05:53 -0700763 visibility = ["//visibility:public"],
764)
765
Austin Schuh30f74292021-08-13 17:25:26 -0700766cc_binary(
767 name = "aos_graph_channels",
768 srcs = [
769 "aos_graph_channels.cc",
770 ],
771 target_compatible_with = ["@platforms//os:linux"],
772 deps = [
773 "//aos:configuration",
774 "//aos:init",
775 "//aos:json_to_flatbuffer",
776 "//aos/events:simulated_event_loop",
777 "//aos/events/logging:log_reader",
778 "//aos/time",
779 "@com_github_gflags_gflags//:gflags",
780 "@com_github_google_glog//:glog",
781 ],
782)
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700783
784cc_library(
785 name = "for_rust",
786 hdrs = [
787 "for_rust.h",
788 ],
789 visibility = ["//visibility:public"],
790 deps = [
Adam Snaider770b97b2023-08-04 21:07:48 -0700791 "@crate_index//:cxx_cc",
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700792 ],
793)
Austin Schuhb0e439d2023-05-15 10:55:40 -0700794
795cc_library(
796 name = "sha256",
797 srcs = [
798 "sha256.cc",
799 ],
800 hdrs = ["sha256.h"],
801 target_compatible_with = ["@platforms//os:linux"],
802 visibility = ["//visibility:public"],
803 deps = [
804 "@boringssl//:crypto",
805 "@com_google_absl//absl/types:span",
806 ],
807)