blob: 7c0ad3dbd44e33f84fdd6a3b6d664d3290017943 [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")
James Kuszmaulf01da392023-12-14 11:22:14 -08002load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
Austin Schuha1d006e2022-09-14 21:50:42 -07003load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
Brian Silvermand1805b62022-07-20 20:47:05 -07004load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
James Kuszmaule4aa01d2022-06-28 14:09:02 -07005load("//aos:flatbuffers.bzl", "cc_static_flatbuffer")
Brian Silverman7edd1ce2022-07-23 16:10:54 -07006load("//tools/build_rules:autocxx.bzl", "autocxx_library")
Austin Schuh972e47e2018-12-20 17:20:58 -08007
Austin Schuh00e302a2020-12-21 11:53:30 -08008exports_files(["aos_dump_autocomplete.sh"])
9
Brian Silverman258b9172015-09-19 14:32:57 -040010filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070011 name = "prime_binaries",
12 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -080013 "//aos:aos_dump",
Tyler Chatowe6f5bef2020-10-31 14:22:04 -070014 "//aos:aos_dump_autocomplete.sh",
Brian Silvermanea2c95f2021-02-10 18:10:26 -080015 "//aos:aos_send",
Austin Schuh91d8d062020-11-02 17:11:13 -080016 "//aos/starter",
Brian Silverman6470f442018-08-05 12:08:16 -070017 ],
18 visibility = ["//visibility:public"],
Austin Schuh1eceeb92015-11-08 21:16:06 -080019)
Austin Schuhc80dd152016-02-29 01:47:44 -080020
21filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070022 name = "prime_start_binaries",
23 srcs = [
James Kuszmaul38735e82019-12-07 16:42:06 -080024 "//aos/events/logging:logger_main",
Brian Silverman6470f442018-08-05 12:08:16 -070025 ],
26 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080027)
Brian Silverman6470f442018-08-05 12:08:16 -070028
Austin Schuhc80dd152016-02-29 01:47:44 -080029filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070030 name = "prime_binaries_stripped",
31 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -080032 "//aos:aos_dump.stripped",
Tyler Chatowe6f5bef2020-10-31 14:22:04 -070033 "//aos:aos_dump_autocomplete.sh",
Brian Silvermanea2c95f2021-02-10 18:10:26 -080034 "//aos:aos_send.stripped",
Austin Schuh44e0b142021-10-16 15:51:10 -070035 "//aos/starter:starter_stripped",
Brian Silverman6470f442018-08-05 12:08:16 -070036 ],
37 visibility = ["//visibility:public"],
38)
39
40filegroup(
41 name = "prime_start_binaries_stripped",
42 srcs = [
James Kuszmaul38735e82019-12-07 16:42:06 -080043 "//aos/events/logging:logger_main.stripped",
Brian Silverman6470f442018-08-05 12:08:16 -070044 ],
45 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080046)
Sabina Davis2ed5ea22017-09-26 22:27:42 -070047
48cc_library(
John Park33858a32018-09-28 23:05:48 -070049 name = "math",
50 hdrs = [
51 "commonmath.h",
52 ],
John Park33858a32018-09-28 23:05:48 -070053 visibility = ["//visibility:public"],
54)
55
Brian Silverman6470f442018-08-05 12:08:16 -070056py_library(
57 name = "python_init",
58 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -080059 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman6470f442018-08-05 12:08:16 -070060 visibility = ["//visibility:public"],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070061)
John Park33858a32018-09-28 23:05:48 -070062
63cc_library(
Austin Schuh972e47e2018-12-20 17:20:58 -080064 name = "macros",
65 hdrs = [
John Park33858a32018-09-28 23:05:48 -070066 "macros.h",
John Park33858a32018-09-28 23:05:48 -070067 ],
68 visibility = ["//visibility:public"],
69)
70
71cc_library(
72 name = "gtest_prod",
73 hdrs = [
74 "gtest_prod.h",
75 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080076 target_compatible_with = ["@platforms//os:linux"],
John Park33858a32018-09-28 23:05:48 -070077 visibility = ["//visibility:public"],
78)
79
80cc_library(
John Park33858a32018-09-28 23:05:48 -070081 name = "unique_malloc_ptr",
82 hdrs = [
83 "unique_malloc_ptr.h",
84 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080085 target_compatible_with = ["@platforms//os:linux"],
John Park33858a32018-09-28 23:05:48 -070086 visibility = ["//visibility:public"],
87)
88
89cc_library(
90 name = "condition",
91 srcs = [
92 "condition.cc",
93 ],
94 hdrs = [
95 "condition.h",
96 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080097 target_compatible_with = ["@platforms//os:linux"],
John Park33858a32018-09-28 23:05:48 -070098 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -080099 deps = [
100 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800101 "//aos/mutex",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700102 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800103 ],
John Park33858a32018-09-28 23:05:48 -0700104)
105
106cc_test(
107 name = "condition_test",
108 srcs = [
109 "condition_test.cc",
110 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800111 target_compatible_with = ["@platforms//os:linux"],
John Park33858a32018-09-28 23:05:48 -0700112 deps = [
113 ":condition",
114 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700115 "//aos/ipc_lib:aos_sync",
116 "//aos/ipc_lib:core_lib",
Austin Schuh972e47e2018-12-20 17:20:58 -0800117 "//aos/logging",
118 "//aos/mutex",
John Park33858a32018-09-28 23:05:48 -0700119 "//aos/testing:googletest",
120 "//aos/testing:prevent_exit",
121 "//aos/testing:test_shm",
Austin Schuh972e47e2018-12-20 17:20:58 -0800122 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700123 ],
124)
125
126cc_library(
127 name = "die",
128 srcs = [
129 "die.cc",
130 ],
131 hdrs = [
132 "die.h",
133 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800134 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800135 visibility = ["//visibility:public"],
John Park33858a32018-09-28 23:05:48 -0700136 deps = [
137 "//aos:macros",
138 "//aos/libc:aos_strerror",
139 ],
John Park33858a32018-09-28 23:05:48 -0700140)
141
John Park33858a32018-09-28 23:05:48 -0700142cc_test(
143 name = "die_test",
144 srcs = [
145 "die_test.cc",
146 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800147 target_compatible_with = ["@platforms//os:linux"],
John Park33858a32018-09-28 23:05:48 -0700148 deps = [
149 ":die",
150 "//aos/testing:googletest",
151 ],
152)
153
John Park398c74a2018-10-20 21:17:39 -0700154cc_binary(
155 name = "dump_rtprio",
156 srcs = [
157 "dump_rtprio.cc",
158 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800159 target_compatible_with = ["@platforms//os:linux"],
John Park398c74a2018-10-20 21:17:39 -0700160 deps = [
Austin Schuh14056182023-01-03 21:19:38 -0800161 "//aos:init",
162 "//aos/events:shm_event_loop",
Austin Schuh972e47e2018-12-20 17:20:58 -0800163 "//aos/time",
Austin Schuh14056182023-01-03 21:19:38 -0800164 "//aos/util:top",
Brian Silverman3eb60d22021-11-04 19:06:47 -0700165 "@com_github_google_glog//:glog",
John Park398c74a2018-10-20 21:17:39 -0700166 ],
167)
168
169cc_library(
John Park398c74a2018-10-20 21:17:39 -0700170 name = "init",
171 srcs = [
172 "init.cc",
173 ],
174 hdrs = [
175 "init.h",
176 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800177 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800178 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700179 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700180 ":realtime",
James Kuszmaula791b762023-07-13 14:56:21 -0700181 ":uuid",
John Park398c74a2018-10-20 21:17:39 -0700182 "//aos:die",
Austin Schuhfc0caa82023-08-25 14:25:03 -0700183 "//aos/logging",
John Park398c74a2018-10-20 21:17:39 -0700184 ],
John Park398c74a2018-10-20 21:17:39 -0700185)
186
Brian Silvermane4c79ce2022-08-15 05:57:28 -0700187autocxx_library(
188 name = "init_rs",
189 srcs = ["init.rs"],
190 crate_name = "aos_init",
191 libs = [
192 ":init",
193 ],
194 override_cc_toolchain = "@llvm_toolchain//:cc-clang-x86_64-linux",
Austin Schuhdfa127f2022-10-26 21:17:42 -0700195 target_compatible_with = select({
196 "//conditions:default": ["//tools/platforms/rust:has_support"],
197 "//tools:has_msan": ["@platforms//:incompatible"],
198 }),
Brian Silvermane4c79ce2022-08-15 05:57:28 -0700199 visibility = ["//visibility:public"],
200)
201
Adam Snaiderc8b7e752023-09-14 14:27:53 -0700202autocxx_library(
203 name = "test_init_rs",
204 testonly = True,
205 srcs = ["test_init.rs"],
206 crate_name = "aos_test_init",
207 libs = [
208 "//aos/testing:tmpdir",
209 ],
210 override_cc_toolchain = "@llvm_toolchain//:cc-clang-x86_64-linux",
211 target_compatible_with = select({
212 "//conditions:default": ["//tools/platforms/rust:has_support"],
213 "//tools:has_msan": ["@platforms//:incompatible"],
214 }),
215 visibility = ["//visibility:public"],
216 deps = [
217 ":init_rs",
218 ],
219)
220
Alex Perrycb7da4b2019-08-28 19:35:56 -0700221cc_library(
222 name = "realtime",
223 srcs = [
224 "realtime.cc",
225 ],
226 hdrs = [
227 "realtime.h",
228 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800229 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700230 visibility = ["//visibility:public"],
231 deps = [
James Kuszmaula791b762023-07-13 14:56:21 -0700232 ":uuid",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700233 "@com_github_google_glog//:glog",
234 ],
235)
236
James Kuszmaulf01da392023-12-14 11:22:14 -0800237static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700238 name = "configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700239 srcs = ["configuration.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800240 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700241 visibility = ["//visibility:public"],
James Kuszmaul1e57af92023-12-20 15:34:54 -0800242 deps = ["//aos/flatbuffers/reflection:reflection_fbs"],
Austin Schuhcb108412019-10-13 16:09:54 -0700243)
244
James Kuszmaule4aa01d2022-06-28 14:09:02 -0700245cc_static_flatbuffer(
246 name = "configuration_schema",
247 function = "aos::ConfigurationSchema",
248 target = ":configuration_fbs_reflection_out",
249 visibility = ["//visibility:public"],
250)
251
Alex Perryd5e13572020-02-22 15:15:08 -0800252flatbuffer_ts_library(
253 name = "configuration_ts_fbs",
254 srcs = ["configuration.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800255 target_compatible_with = ["@platforms//os:linux"],
Alex Perryd5e13572020-02-22 15:15:08 -0800256 visibility = ["//visibility:public"],
257)
258
Brian Silverman28760272020-02-02 13:21:51 -0800259flatbuffer_py_library(
James Kuszmaul7daef362019-12-31 18:28:17 -0800260 name = "configuration_fbs_python",
261 srcs = ["configuration.fbs"],
262 namespace = "aos",
263 tables = [
264 "Configuration",
265 "Channel",
James Kuszmaul84ff3e52020-01-03 19:48:53 -0800266 "Connection",
James Kuszmaul7daef362019-12-31 18:28:17 -0800267 "Map",
268 "Node",
269 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800270 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul7daef362019-12-31 18:28:17 -0800271 visibility = ["//visibility:public"],
272)
273
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700274flatbuffer_rust_library(
275 name = "configuration_rust_fbs",
276 srcs = ["configuration.fbs"],
277 crate_name = "aos_configuration_fbs",
Austin Schuhdfa127f2022-10-26 21:17:42 -0700278 target_compatible_with = select({
279 "//conditions:default": ["//tools/platforms/rust:has_support"],
280 "//tools:has_msan": ["@platforms//:incompatible"],
281 }),
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700282 visibility = ["//visibility:public"],
283)
284
John Park398c74a2018-10-20 21:17:39 -0700285cc_library(
286 name = "configuration",
287 srcs = [
288 "configuration.cc",
289 ],
290 hdrs = [
291 "configuration.h",
292 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800293 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800294 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700295 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700296 ":configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700297 ":flatbuffer_merge",
298 ":flatbuffers",
299 ":json_to_flatbuffer",
John Park398c74a2018-10-20 21:17:39 -0700300 "//aos:unique_malloc_ptr",
Austin Schuh83cbb1e2023-06-23 12:59:02 -0700301 "//aos/ipc_lib:index",
Austin Schuh217a9782019-12-21 23:02:50 -0800302 "//aos/network:team_number",
Austin Schuhcb108412019-10-13 16:09:54 -0700303 "//aos/util:file",
304 "@com_github_google_glog//:glog",
305 "@com_google_absl//absl/container:btree",
306 "@com_google_absl//absl/strings",
John Park398c74a2018-10-20 21:17:39 -0700307 ],
John Park398c74a2018-10-20 21:17:39 -0700308)
309
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700310cc_library(
311 name = "configuration_for_rust",
312 srcs = [
313 "configuration_for_rust.cc",
314 ],
315 hdrs = [
316 "configuration_for_rust.h",
317 ],
318 deps = [
319 ":configuration",
320 ":for_rust",
Adam Snaider770b97b2023-08-04 21:07:48 -0700321 "@crate_index//:cxx_cc",
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700322 ],
323)
324
325autocxx_library(
326 name = "configuration_rs",
327 srcs = ["configuration.rs"],
328 crate_name = "aos_configuration",
329 libs = [
330 ":configuration",
331 ":configuration_for_rust",
332 ":configuration_fbs",
333 ],
334 override_cc_toolchain = "@llvm_toolchain//:cc-clang-x86_64-linux",
Austin Schuhdfa127f2022-10-26 21:17:42 -0700335 target_compatible_with = select({
336 "//conditions:default": ["//tools/platforms/rust:has_support"],
337 "//tools:has_msan": ["@platforms//:incompatible"],
338 }),
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700339 visibility = ["//visibility:public"],
340 deps = [
341 ":configuration_rust_fbs",
342 ":flatbuffers_rs",
Adam Snaider770b97b2023-08-04 21:07:48 -0700343 "@crate_index//:thiserror",
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700344 ],
345)
346
347rust_test(
348 name = "configuration_rs_test",
349 crate = ":configuration_rs",
350 data = [
351 "//aos/testdata:test_configs",
352 ],
353 # TODO: Make Rust play happy with pic vs nopic. Details at:
354 # https://github.com/bazelbuild/rules_rust/issues/118
355 rustc_flags = ["-Crelocation-model=static"],
356)
357
James Kuszmaulabb77132020-08-01 19:56:16 -0700358flatbuffer_ts_library(
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800359 name = "json_to_flatbuffer_fbs_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -0700360 srcs = ["json_to_flatbuffer.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800361 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700362 visibility = ["//aos:__subpackages__"],
363)
364
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700365flatbuffer_cc_library(
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800366 name = "json_to_flatbuffer_fbs",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700367 srcs = ["json_to_flatbuffer.fbs"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800368 gen_reflections = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800369 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700370 visibility = ["//aos:__subpackages__"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700371)
372
Brian Silvermand1805b62022-07-20 20:47:05 -0700373flatbuffer_rust_library(
374 name = "json_to_flatbuffer_rust_fbs",
375 srcs = ["json_to_flatbuffer.fbs"],
376 crate_name = "aos_json_to_flatbuffer_fbs",
Austin Schuhdfa127f2022-10-26 21:17:42 -0700377 target_compatible_with = select({
378 "//conditions:default": ["//tools/platforms/rust:has_support"],
379 "//tools:has_msan": ["@platforms//:incompatible"],
380 }),
Brian Silvermand1805b62022-07-20 20:47:05 -0700381 visibility = ["//aos:__subpackages__"],
382)
383
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700384cc_library(
Austin Schuh43c6a352019-09-30 22:22:10 -0700385 name = "flatbuffer_utils",
386 srcs = ["flatbuffer_utils.cc"],
387 hdrs = ["flatbuffer_utils.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800388 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul4ed5fb12022-03-22 15:20:04 -0700389 visibility = ["//visibility:public"],
Austin Schuh43c6a352019-09-30 22:22:10 -0700390 deps = [
391 "@com_github_google_flatbuffers//:flatbuffers",
Brian Silvermancf4fb662021-02-10 17:54:53 -0800392 "@com_github_google_glog//:glog",
Austin Schuh43c6a352019-09-30 22:22:10 -0700393 ],
394)
395
396cc_library(
Austin Schuhd7e252d2019-10-06 13:51:02 -0700397 name = "json_tokenizer",
398 srcs = ["json_tokenizer.cc"],
399 hdrs = ["json_tokenizer.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800400 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd7e252d2019-10-06 13:51:02 -0700401 deps = [
Pallavi Madhukare2eb2812022-07-19 09:56:09 -0700402 "@com_github_google_flatbuffers//:flatbuffers",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700403 "@com_github_google_glog//:glog",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700404 "@com_google_absl//absl/strings",
405 ],
406)
407
408cc_library(
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700409 name = "json_to_flatbuffer",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800410 srcs = [
411 "flatbuffer_introspection.cc",
412 "json_to_flatbuffer.cc",
413 ],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700414 hdrs = ["json_to_flatbuffer.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800415 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700416 visibility = ["//visibility:public"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700417 deps = [
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700418 ":fast_string_builder",
Austin Schuh43c6a352019-09-30 22:22:10 -0700419 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700420 ":flatbuffers",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700421 ":json_tokenizer",
James Kuszmaulf5eb4682023-09-22 17:16:59 -0700422 "//aos/flatbuffers:builder",
Austin Schuhbba10282021-03-20 22:03:28 -0700423 "//aos/util:file",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700424 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuhe93d8642019-10-13 15:27:07 -0700425 "@com_github_google_glog//:glog",
Austin Schuhd339a9b2019-10-05 21:33:32 -0700426 "@com_google_absl//absl/strings",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700427 ],
428)
429
430cc_test(
431 name = "json_to_flatbuffer_test",
432 srcs = [
433 "json_to_flatbuffer_test.cc",
434 ],
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800435 data = [
436 ":json_to_flatbuffer_fbs_reflection_out",
Alexander Yeee61cac32023-02-11 19:40:40 -0800437 ":json_to_flatbuffer_test_spaces.json",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800438 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800439 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700440 deps = [
Alexander Yeee61cac32023-02-11 19:40:40 -0800441 ":flatbuffer_merge",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700442 ":json_to_flatbuffer",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800443 ":json_to_flatbuffer_fbs",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700444 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -0700445 "//aos/testing:path",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700446 ],
447)
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700448
Tyler Chatow5e369a42019-11-23 11:57:31 -0800449cc_test(
450 name = "flatbuffer_introspection_test",
451 srcs = [
452 "flatbuffer_introspection_test.cc",
453 ],
454 data = [
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800455 ":json_to_flatbuffer_fbs_reflection_out",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800456 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800457 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800458 deps = [
459 ":json_to_flatbuffer",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800460 ":json_to_flatbuffer_fbs",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800461 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -0700462 "//aos/testing:path",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800463 "//aos/util:file",
464 "@com_github_google_flatbuffers//:flatbuffers",
465 ],
466)
467
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700468cc_library(
469 name = "flatbuffer_merge",
470 srcs = ["flatbuffer_merge.cc"],
471 hdrs = ["flatbuffer_merge.h"],
472 copts = ["-Wno-cast-align"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800473 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700474 visibility = ["//visibility:public"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700475 deps = [
476 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700477 ":flatbuffers",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700478 "@com_github_google_flatbuffers//:flatbuffers",
479 ],
480)
481
482cc_test(
483 name = "flatbuffer_merge_test",
484 srcs = [
485 "flatbuffer_merge_test.cc",
486 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800487 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700488 deps = [
489 ":flatbuffer_merge",
490 ":json_to_flatbuffer",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800491 ":json_to_flatbuffer_fbs",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700492 "//aos/testing:googletest",
493 ],
494)
Austin Schuhe93d8642019-10-13 15:27:07 -0700495
496cc_library(
497 name = "flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700498 srcs = [
499 "flatbuffers.cc",
500 ],
Austin Schuhe93d8642019-10-13 15:27:07 -0700501 hdrs = [
502 "flatbuffers.h",
503 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800504 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh40485ed2019-10-26 21:51:44 -0700505 visibility = ["//visibility:public"],
Austin Schuhe93d8642019-10-13 15:27:07 -0700506 deps = [
James Kuszmaulad8a8082020-02-14 21:21:58 -0800507 "//aos:macros",
Brian Silverman354697a2020-09-22 21:06:32 -0700508 "//aos/containers:resizeable_buffer",
davidjevans8b9b52f2021-09-17 08:57:30 -0700509 "//aos/util:file",
Austin Schuhe93d8642019-10-13 15:27:07 -0700510 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700511 "@com_github_google_glog//:glog",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700512 "@com_google_absl//absl/strings",
Austin Schuh6f3babe2020-01-26 20:34:50 -0800513 "@com_google_absl//absl/types:span",
Austin Schuhe93d8642019-10-13 15:27:07 -0700514 ],
515)
Austin Schuhcb108412019-10-13 16:09:54 -0700516
Brian Silvermand1805b62022-07-20 20:47:05 -0700517rust_library(
518 name = "flatbuffers_rs",
519 srcs = ["flatbuffers.rs"],
520 crate_name = "aos_flatbuffers",
Austin Schuhdfa127f2022-10-26 21:17:42 -0700521 target_compatible_with = select({
522 "//conditions:default": ["//tools/platforms/rust:has_support"],
523 "//tools:has_msan": ["@platforms//:incompatible"],
524 }),
Brian Silvermand1805b62022-07-20 20:47:05 -0700525 visibility = ["//visibility:public"],
526 deps = [
527 "@com_github_google_flatbuffers//rust",
528 ],
529)
530
531rust_test(
532 name = "flatbuffers_rs_test",
533 crate = ":flatbuffers_rs",
534 deps = [
535 ":json_to_flatbuffer_rust_fbs",
536 ],
537)
538
Austin Schuhcb108412019-10-13 16:09:54 -0700539cc_test(
540 name = "configuration_test",
541 srcs = [
542 "configuration_test.cc",
543 ],
544 data = [
Nathan Leong307c9692022-10-08 15:25:03 -0700545 "//aos/events:ping_fbs_reflection_out",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700546 "//aos/events:pingpong_config",
Brian Silvermandae15a12022-07-23 12:55:20 -0700547 "//aos/events:pong_fbs_reflection_out",
James Kuszmaulc0c08da2020-05-10 18:56:07 -0700548 "//aos/testdata:test_configs",
Austin Schuhcb108412019-10-13 16:09:54 -0700549 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800550 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhcb108412019-10-13 16:09:54 -0700551 deps = [
552 ":configuration",
Nathan Leong307c9692022-10-08 15:25:03 -0700553 "//aos/events:ping_fbs",
Austin Schuh1ef01ef2021-02-07 20:40:36 -0800554 "//aos/testing:flatbuffer_eq",
Austin Schuhcb108412019-10-13 16:09:54 -0700555 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -0700556 "//aos/testing:path",
Austin Schuhcb108412019-10-13 16:09:54 -0700557 "//aos/testing:test_logging",
558 ],
559)
Alex Perrycb7da4b2019-08-28 19:35:56 -0700560
561cc_binary(
562 name = "config_flattener",
563 srcs = [
564 "config_flattener.cc",
565 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800566 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700567 visibility = ["//visibility:public"],
568 deps = [
569 ":configuration",
570 ":init",
571 "//aos/util:file",
572 "@com_github_google_glog//:glog",
573 ],
574)
Tyler Chatow5e369a42019-11-23 11:57:31 -0800575
Brian Silvermanea2c95f2021-02-10 18:10:26 -0800576cc_library(
577 name = "aos_cli_utils",
578 srcs = [
579 "aos_cli_utils.cc",
580 ],
581 hdrs = [
582 "aos_cli_utils.h",
583 ],
584 target_compatible_with = ["@platforms//os:linux"],
585 visibility = ["//visibility:public"],
586 deps = [
587 ":configuration",
588 "//aos:init",
589 "//aos/events:shm_event_loop",
Austin Schuh893d7f42022-09-16 15:01:35 -0700590 "//aos/events:simulated_event_loop",
Brian Silvermanea2c95f2021-02-10 18:10:26 -0800591 "@com_github_google_glog//:glog",
592 ],
593)
594
Tyler Chatow5e369a42019-11-23 11:57:31 -0800595cc_binary(
Austin Schuh944df342019-12-21 17:08:55 -0800596 name = "aos_dump",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800597 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -0800598 "aos_dump.cc",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800599 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800600 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800601 visibility = ["//visibility:public"],
602 deps = [
Brian Silvermanea2c95f2021-02-10 18:10:26 -0800603 ":aos_cli_utils",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800604 ":configuration",
605 ":json_to_flatbuffer",
606 "//aos:init",
Brian Silvermanea2c95f2021-02-10 18:10:26 -0800607 "@com_github_google_glog//:glog",
608 ],
609)
610
611cc_binary(
612 name = "aos_send",
613 srcs = [
614 "aos_send.cc",
615 ],
616 target_compatible_with = ["@platforms//os:linux"],
617 visibility = ["//visibility:public"],
618 deps = [
619 ":aos_cli_utils",
620 ":configuration",
621 ":init",
622 ":json_to_flatbuffer",
623 "@com_github_gflags_gflags//:gflags",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800624 "@com_github_google_glog//:glog",
625 ],
626)
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500627
Jim Ostrowski17ce54d2020-10-24 17:24:01 -0700628cc_binary(
629 name = "aos_graph_nodes",
630 srcs = [
631 "aos_graph_nodes.cc",
632 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800633 target_compatible_with = ["@platforms//os:linux"],
Jim Ostrowski17ce54d2020-10-24 17:24:01 -0700634 visibility = ["//visibility:public"],
635 deps = [
636 ":configuration",
637 ":json_to_flatbuffer",
638 "//aos:init",
639 "//aos/events:shm_event_loop",
640 "@com_github_google_glog//:glog",
641 ],
642)
643
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500644cc_library(
645 name = "ftrace",
646 srcs = [
647 "ftrace.cc",
648 ],
649 hdrs = [
650 "ftrace.h",
651 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800652 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500653 visibility = ["//visibility:public"],
654 deps = [
655 "@com_github_google_glog//:glog",
Austin Schuhc9de0132022-12-26 18:04:53 -0800656 "@com_google_absl//absl/strings",
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500657 ],
658)
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700659
660cc_library(
661 name = "fast_string_builder",
662 srcs = [
663 "fast_string_builder.cc",
664 ],
665 hdrs = [
666 "fast_string_builder.h",
667 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800668 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul4ed5fb12022-03-22 15:20:04 -0700669 visibility = ["//visibility:public"],
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700670 deps = [
671 "@com_github_google_glog//:glog",
672 "@com_google_absl//absl/strings",
673 "@com_google_absl//absl/strings:str_format",
674 ],
675)
Brian Silvermanb47f5552020-10-01 15:08:14 -0700676
Austin Schuhcc6070c2020-10-10 20:25:56 -0700677cc_test(
678 name = "realtime_test",
679 srcs = [
680 "realtime_test.cc",
681 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800682 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhcc6070c2020-10-10 20:25:56 -0700683 visibility = ["//visibility:public"],
684 deps = [
Austin Schuh77f3f222022-06-10 16:49:21 -0700685 ":init",
Austin Schuhcc6070c2020-10-10 20:25:56 -0700686 ":realtime",
Austin Schuh77f3f222022-06-10 16:49:21 -0700687 "@com_github_gflags_gflags//:gflags",
688 "@com_github_google_glog//:glog",
689 "@com_google_googletest//:gtest",
Austin Schuhcc6070c2020-10-10 20:25:56 -0700690 ],
691)
Austin Schuh977a5ed2020-12-02 23:20:04 -0800692
693cc_test(
694 name = "flatbuffers_test",
695 srcs = [
696 "flatbuffers_test.cc",
697 ],
698 deps = [
699 ":flatbuffers",
700 ":json_to_flatbuffer",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800701 ":json_to_flatbuffer_fbs",
Austin Schuh977a5ed2020-12-02 23:20:04 -0800702 "//aos/testing:googletest",
davidjevans8b9b52f2021-09-17 08:57:30 -0700703 "//aos/testing:tmpdir",
Austin Schuh977a5ed2020-12-02 23:20:04 -0800704 ],
705)
Austin Schuh0de30f32020-12-06 12:44:28 -0800706
707py_binary(
708 name = "flatbuffers_static",
709 srcs = ["flatbuffers_static.py"],
710 visibility = ["//visibility:public"],
711)
Austin Schuh4385b142021-03-14 21:31:13 -0700712
713cc_library(
714 name = "uuid",
715 srcs = ["uuid.cc"],
716 hdrs = ["uuid.h"],
717 target_compatible_with = ["@platforms//os:linux"],
718 visibility = ["//visibility:public"],
719 deps = [
Austin Schuh8902fa52021-03-14 22:39:24 -0700720 "@com_github_gflags_gflags//:gflags",
Austin Schuh4385b142021-03-14 21:31:13 -0700721 "@com_github_google_flatbuffers//:flatbuffers",
722 "@com_github_google_glog//:glog",
723 "@com_google_absl//absl/types:span",
724 ],
725)
726
727cc_test(
James Kuszmaul05ccb272023-07-13 10:58:14 -0700728 name = "uuid_collision_test",
James Kuszmaula791b762023-07-13 14:56:21 -0700729 timeout = "eternal",
James Kuszmaul05ccb272023-07-13 10:58:14 -0700730 srcs = ["uuid_collision_test.cc"],
James Kuszmaula791b762023-07-13 14:56:21 -0700731 shard_count = 2,
James Kuszmaul05ccb272023-07-13 10:58:14 -0700732 target_compatible_with = ["@platforms//os:linux"],
733 deps = [
734 ":uuid",
735 "//aos/testing:googletest",
736 ],
737)
738
739cc_test(
Austin Schuh4385b142021-03-14 21:31:13 -0700740 name = "uuid_test",
741 srcs = ["uuid_test.cc"],
742 target_compatible_with = ["@platforms//os:linux"],
743 deps = [
744 ":uuid",
745 "//aos/testing:googletest",
746 ],
747)
Austin Schuh30f74292021-08-13 17:25:26 -0700748
Brian Silverman10599932022-08-15 06:05:53 -0700749cc_library(
750 name = "uuid_for_rust",
751 hdrs = ["uuid_for_rust.h"],
752 deps = [
753 ":uuid",
754 ],
755)
756
757autocxx_library(
758 name = "uuid_rs",
759 srcs = ["uuid.rs"],
760 crate_name = "aos_uuid",
761 libs = [
762 ":uuid",
763 ":uuid_for_rust",
764 ],
765 override_cc_toolchain = "@llvm_toolchain//:cc-clang-x86_64-linux",
766 rs_deps = [
Adam Snaider770b97b2023-08-04 21:07:48 -0700767 "@crate_index//:uuid",
Brian Silverman10599932022-08-15 06:05:53 -0700768 ],
Austin Schuhdfa127f2022-10-26 21:17:42 -0700769 target_compatible_with = select({
770 "//conditions:default": ["//tools/platforms/rust:has_support"],
771 "//tools:has_msan": ["@platforms//:incompatible"],
772 }),
Brian Silverman10599932022-08-15 06:05:53 -0700773 visibility = ["//visibility:public"],
774)
775
Austin Schuh30f74292021-08-13 17:25:26 -0700776cc_binary(
777 name = "aos_graph_channels",
778 srcs = [
779 "aos_graph_channels.cc",
780 ],
781 target_compatible_with = ["@platforms//os:linux"],
782 deps = [
783 "//aos:configuration",
784 "//aos:init",
785 "//aos:json_to_flatbuffer",
786 "//aos/events:simulated_event_loop",
787 "//aos/events/logging:log_reader",
788 "//aos/time",
789 "@com_github_gflags_gflags//:gflags",
790 "@com_github_google_glog//:glog",
791 ],
792)
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700793
794cc_library(
795 name = "for_rust",
796 hdrs = [
797 "for_rust.h",
798 ],
799 visibility = ["//visibility:public"],
800 deps = [
Adam Snaider770b97b2023-08-04 21:07:48 -0700801 "@crate_index//:cxx_cc",
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700802 ],
803)
Austin Schuhb0e439d2023-05-15 10:55:40 -0700804
805cc_library(
806 name = "sha256",
807 srcs = [
808 "sha256.cc",
809 ],
810 hdrs = ["sha256.h"],
811 target_compatible_with = ["@platforms//os:linux"],
812 visibility = ["//visibility:public"],
813 deps = [
James Kuszmaul56802ab2023-08-23 15:18:34 -0700814 "//aos/util:file",
Austin Schuhb0e439d2023-05-15 10:55:40 -0700815 "@boringssl//:crypto",
816 "@com_google_absl//absl/types:span",
817 ],
818)
James Kuszmaul56802ab2023-08-23 15:18:34 -0700819
820cc_test(
821 name = "sha256_test",
822 srcs = ["sha256_test.cc"],
823 deps = [
824 ":sha256",
825 "//aos/testing:googletest",
826 "//aos/testing:tmpdir",
827 ],
828)