blob: 7724574cfdb4bad9b7d07f75807eb35b46747c64 [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
Adam Snaider48a62f32023-10-02 15:49:23 -0700187cc_library(
188 name = "init_for_rust",
189 srcs = [
190 "init_for_rust.cc",
191 ],
192 hdrs = [
193 "init_for_rust.h",
194 ],
195 deps = [
196 ":for_rust",
197 ":init",
198 "//aos/logging",
199 "@com_github_gflags_gflags//:gflags",
200 "@crate_index//:cxx_cc",
201 ],
202)
203
Brian Silvermane4c79ce2022-08-15 05:57:28 -0700204autocxx_library(
205 name = "init_rs",
206 srcs = ["init.rs"],
207 crate_name = "aos_init",
208 libs = [
Adam Snaider48a62f32023-10-02 15:49:23 -0700209 ":init_for_rust",
Brian Silvermane4c79ce2022-08-15 05:57:28 -0700210 ],
211 override_cc_toolchain = "@llvm_toolchain//:cc-clang-x86_64-linux",
Austin Schuhdfa127f2022-10-26 21:17:42 -0700212 target_compatible_with = select({
213 "//conditions:default": ["//tools/platforms/rust:has_support"],
214 "//tools:has_msan": ["@platforms//:incompatible"],
215 }),
Brian Silvermane4c79ce2022-08-15 05:57:28 -0700216 visibility = ["//visibility:public"],
Adam Snaider48a62f32023-10-02 15:49:23 -0700217 deps = [
218 "@crate_index//:clap",
219 ],
220)
221
222rust_test(
223 name = "init_rs_test",
224 crate = ":init_rs",
225 rustc_flags = ["-Crelocation-model=static"],
226 target_compatible_with = select({
227 "//conditions:default": ["//tools/platforms/rust:has_support"],
228 "//tools:has_msan": ["@platforms//:incompatible"],
229 }),
Brian Silvermane4c79ce2022-08-15 05:57:28 -0700230)
231
Adam Snaiderc8b7e752023-09-14 14:27:53 -0700232autocxx_library(
233 name = "test_init_rs",
234 testonly = True,
235 srcs = ["test_init.rs"],
236 crate_name = "aos_test_init",
237 libs = [
238 "//aos/testing:tmpdir",
239 ],
240 override_cc_toolchain = "@llvm_toolchain//:cc-clang-x86_64-linux",
241 target_compatible_with = select({
242 "//conditions:default": ["//tools/platforms/rust:has_support"],
243 "//tools:has_msan": ["@platforms//:incompatible"],
244 }),
245 visibility = ["//visibility:public"],
246 deps = [
247 ":init_rs",
248 ],
249)
250
Alex Perrycb7da4b2019-08-28 19:35:56 -0700251cc_library(
252 name = "realtime",
253 srcs = [
254 "realtime.cc",
255 ],
256 hdrs = [
257 "realtime.h",
258 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800259 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700260 visibility = ["//visibility:public"],
261 deps = [
James Kuszmaula791b762023-07-13 14:56:21 -0700262 ":uuid",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700263 "@com_github_google_glog//:glog",
264 ],
265)
266
James Kuszmaulf01da392023-12-14 11:22:14 -0800267static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700268 name = "configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700269 srcs = ["configuration.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800270 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700271 visibility = ["//visibility:public"],
James Kuszmaul1e57af92023-12-20 15:34:54 -0800272 deps = ["//aos/flatbuffers/reflection:reflection_fbs"],
Austin Schuhcb108412019-10-13 16:09:54 -0700273)
274
James Kuszmaule4aa01d2022-06-28 14:09:02 -0700275cc_static_flatbuffer(
276 name = "configuration_schema",
277 function = "aos::ConfigurationSchema",
278 target = ":configuration_fbs_reflection_out",
279 visibility = ["//visibility:public"],
280)
281
Alex Perryd5e13572020-02-22 15:15:08 -0800282flatbuffer_ts_library(
283 name = "configuration_ts_fbs",
284 srcs = ["configuration.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800285 target_compatible_with = ["@platforms//os:linux"],
Alex Perryd5e13572020-02-22 15:15:08 -0800286 visibility = ["//visibility:public"],
287)
288
Brian Silverman28760272020-02-02 13:21:51 -0800289flatbuffer_py_library(
James Kuszmaul7daef362019-12-31 18:28:17 -0800290 name = "configuration_fbs_python",
291 srcs = ["configuration.fbs"],
292 namespace = "aos",
293 tables = [
294 "Configuration",
295 "Channel",
James Kuszmaul84ff3e52020-01-03 19:48:53 -0800296 "Connection",
James Kuszmaul7daef362019-12-31 18:28:17 -0800297 "Map",
298 "Node",
299 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800300 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul7daef362019-12-31 18:28:17 -0800301 visibility = ["//visibility:public"],
302)
303
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700304flatbuffer_rust_library(
305 name = "configuration_rust_fbs",
306 srcs = ["configuration.fbs"],
307 crate_name = "aos_configuration_fbs",
Austin Schuhdfa127f2022-10-26 21:17:42 -0700308 target_compatible_with = select({
309 "//conditions:default": ["//tools/platforms/rust:has_support"],
310 "//tools:has_msan": ["@platforms//:incompatible"],
311 }),
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700312 visibility = ["//visibility:public"],
313)
314
John Park398c74a2018-10-20 21:17:39 -0700315cc_library(
316 name = "configuration",
317 srcs = [
318 "configuration.cc",
319 ],
320 hdrs = [
321 "configuration.h",
322 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800323 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800324 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700325 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700326 ":configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700327 ":flatbuffer_merge",
328 ":flatbuffers",
329 ":json_to_flatbuffer",
John Park398c74a2018-10-20 21:17:39 -0700330 "//aos:unique_malloc_ptr",
Austin Schuh83cbb1e2023-06-23 12:59:02 -0700331 "//aos/ipc_lib:index",
Austin Schuh217a9782019-12-21 23:02:50 -0800332 "//aos/network:team_number",
Austin Schuhcb108412019-10-13 16:09:54 -0700333 "//aos/util:file",
334 "@com_github_google_glog//:glog",
335 "@com_google_absl//absl/container:btree",
336 "@com_google_absl//absl/strings",
John Park398c74a2018-10-20 21:17:39 -0700337 ],
John Park398c74a2018-10-20 21:17:39 -0700338)
339
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700340cc_library(
341 name = "configuration_for_rust",
342 srcs = [
343 "configuration_for_rust.cc",
344 ],
345 hdrs = [
346 "configuration_for_rust.h",
347 ],
348 deps = [
349 ":configuration",
350 ":for_rust",
Adam Snaider770b97b2023-08-04 21:07:48 -0700351 "@crate_index//:cxx_cc",
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700352 ],
353)
354
355autocxx_library(
356 name = "configuration_rs",
357 srcs = ["configuration.rs"],
358 crate_name = "aos_configuration",
359 libs = [
360 ":configuration",
361 ":configuration_for_rust",
362 ":configuration_fbs",
363 ],
364 override_cc_toolchain = "@llvm_toolchain//:cc-clang-x86_64-linux",
Austin Schuhdfa127f2022-10-26 21:17:42 -0700365 target_compatible_with = select({
366 "//conditions:default": ["//tools/platforms/rust:has_support"],
367 "//tools:has_msan": ["@platforms//:incompatible"],
368 }),
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700369 visibility = ["//visibility:public"],
370 deps = [
371 ":configuration_rust_fbs",
372 ":flatbuffers_rs",
Adam Snaider770b97b2023-08-04 21:07:48 -0700373 "@crate_index//:thiserror",
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700374 ],
375)
376
377rust_test(
378 name = "configuration_rs_test",
379 crate = ":configuration_rs",
380 data = [
381 "//aos/testdata:test_configs",
382 ],
383 # TODO: Make Rust play happy with pic vs nopic. Details at:
384 # https://github.com/bazelbuild/rules_rust/issues/118
385 rustc_flags = ["-Crelocation-model=static"],
386)
387
James Kuszmaulabb77132020-08-01 19:56:16 -0700388flatbuffer_ts_library(
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800389 name = "json_to_flatbuffer_fbs_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -0700390 srcs = ["json_to_flatbuffer.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800391 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700392 visibility = ["//aos:__subpackages__"],
393)
394
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700395flatbuffer_cc_library(
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800396 name = "json_to_flatbuffer_fbs",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700397 srcs = ["json_to_flatbuffer.fbs"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800398 gen_reflections = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800399 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700400 visibility = ["//aos:__subpackages__"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700401)
402
Brian Silvermand1805b62022-07-20 20:47:05 -0700403flatbuffer_rust_library(
404 name = "json_to_flatbuffer_rust_fbs",
405 srcs = ["json_to_flatbuffer.fbs"],
406 crate_name = "aos_json_to_flatbuffer_fbs",
Austin Schuhdfa127f2022-10-26 21:17:42 -0700407 target_compatible_with = select({
408 "//conditions:default": ["//tools/platforms/rust:has_support"],
409 "//tools:has_msan": ["@platforms//:incompatible"],
410 }),
Brian Silvermand1805b62022-07-20 20:47:05 -0700411 visibility = ["//aos:__subpackages__"],
412)
413
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700414cc_library(
Austin Schuh43c6a352019-09-30 22:22:10 -0700415 name = "flatbuffer_utils",
416 srcs = ["flatbuffer_utils.cc"],
417 hdrs = ["flatbuffer_utils.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800418 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul4ed5fb12022-03-22 15:20:04 -0700419 visibility = ["//visibility:public"],
Austin Schuh43c6a352019-09-30 22:22:10 -0700420 deps = [
421 "@com_github_google_flatbuffers//:flatbuffers",
Brian Silvermancf4fb662021-02-10 17:54:53 -0800422 "@com_github_google_glog//:glog",
Austin Schuh43c6a352019-09-30 22:22:10 -0700423 ],
424)
425
426cc_library(
Austin Schuhd7e252d2019-10-06 13:51:02 -0700427 name = "json_tokenizer",
428 srcs = ["json_tokenizer.cc"],
429 hdrs = ["json_tokenizer.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800430 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd7e252d2019-10-06 13:51:02 -0700431 deps = [
Pallavi Madhukare2eb2812022-07-19 09:56:09 -0700432 "@com_github_google_flatbuffers//:flatbuffers",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700433 "@com_github_google_glog//:glog",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700434 "@com_google_absl//absl/strings",
435 ],
436)
437
438cc_library(
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700439 name = "json_to_flatbuffer",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800440 srcs = [
441 "flatbuffer_introspection.cc",
442 "json_to_flatbuffer.cc",
443 ],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700444 hdrs = ["json_to_flatbuffer.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800445 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700446 visibility = ["//visibility:public"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700447 deps = [
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700448 ":fast_string_builder",
Austin Schuh43c6a352019-09-30 22:22:10 -0700449 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700450 ":flatbuffers",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700451 ":json_tokenizer",
James Kuszmaulf5eb4682023-09-22 17:16:59 -0700452 "//aos/flatbuffers:builder",
Austin Schuhbba10282021-03-20 22:03:28 -0700453 "//aos/util:file",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700454 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuhe93d8642019-10-13 15:27:07 -0700455 "@com_github_google_glog//:glog",
Austin Schuhd339a9b2019-10-05 21:33:32 -0700456 "@com_google_absl//absl/strings",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700457 ],
458)
459
460cc_test(
461 name = "json_to_flatbuffer_test",
462 srcs = [
463 "json_to_flatbuffer_test.cc",
464 ],
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800465 data = [
466 ":json_to_flatbuffer_fbs_reflection_out",
Alexander Yeee61cac32023-02-11 19:40:40 -0800467 ":json_to_flatbuffer_test_spaces.json",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800468 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800469 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700470 deps = [
Alexander Yeee61cac32023-02-11 19:40:40 -0800471 ":flatbuffer_merge",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700472 ":json_to_flatbuffer",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800473 ":json_to_flatbuffer_fbs",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700474 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -0700475 "//aos/testing:path",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700476 ],
477)
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700478
Tyler Chatow5e369a42019-11-23 11:57:31 -0800479cc_test(
480 name = "flatbuffer_introspection_test",
481 srcs = [
482 "flatbuffer_introspection_test.cc",
483 ],
484 data = [
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800485 ":json_to_flatbuffer_fbs_reflection_out",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800486 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800487 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800488 deps = [
489 ":json_to_flatbuffer",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800490 ":json_to_flatbuffer_fbs",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800491 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -0700492 "//aos/testing:path",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800493 "//aos/util:file",
494 "@com_github_google_flatbuffers//:flatbuffers",
495 ],
496)
497
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700498cc_library(
499 name = "flatbuffer_merge",
500 srcs = ["flatbuffer_merge.cc"],
501 hdrs = ["flatbuffer_merge.h"],
502 copts = ["-Wno-cast-align"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800503 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700504 visibility = ["//visibility:public"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700505 deps = [
506 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700507 ":flatbuffers",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700508 "@com_github_google_flatbuffers//:flatbuffers",
509 ],
510)
511
512cc_test(
513 name = "flatbuffer_merge_test",
514 srcs = [
515 "flatbuffer_merge_test.cc",
516 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800517 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700518 deps = [
519 ":flatbuffer_merge",
520 ":json_to_flatbuffer",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800521 ":json_to_flatbuffer_fbs",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700522 "//aos/testing:googletest",
523 ],
524)
Austin Schuhe93d8642019-10-13 15:27:07 -0700525
526cc_library(
527 name = "flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700528 srcs = [
529 "flatbuffers.cc",
530 ],
Austin Schuhe93d8642019-10-13 15:27:07 -0700531 hdrs = [
532 "flatbuffers.h",
533 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800534 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh40485ed2019-10-26 21:51:44 -0700535 visibility = ["//visibility:public"],
Austin Schuhe93d8642019-10-13 15:27:07 -0700536 deps = [
James Kuszmaulad8a8082020-02-14 21:21:58 -0800537 "//aos:macros",
Brian Silverman354697a2020-09-22 21:06:32 -0700538 "//aos/containers:resizeable_buffer",
davidjevans8b9b52f2021-09-17 08:57:30 -0700539 "//aos/util:file",
Austin Schuhe93d8642019-10-13 15:27:07 -0700540 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700541 "@com_github_google_glog//:glog",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700542 "@com_google_absl//absl/strings",
Austin Schuh6f3babe2020-01-26 20:34:50 -0800543 "@com_google_absl//absl/types:span",
Austin Schuhe93d8642019-10-13 15:27:07 -0700544 ],
545)
Austin Schuhcb108412019-10-13 16:09:54 -0700546
Brian Silvermand1805b62022-07-20 20:47:05 -0700547rust_library(
548 name = "flatbuffers_rs",
549 srcs = ["flatbuffers.rs"],
550 crate_name = "aos_flatbuffers",
Austin Schuhdfa127f2022-10-26 21:17:42 -0700551 target_compatible_with = select({
552 "//conditions:default": ["//tools/platforms/rust:has_support"],
553 "//tools:has_msan": ["@platforms//:incompatible"],
554 }),
Brian Silvermand1805b62022-07-20 20:47:05 -0700555 visibility = ["//visibility:public"],
556 deps = [
557 "@com_github_google_flatbuffers//rust",
558 ],
559)
560
561rust_test(
562 name = "flatbuffers_rs_test",
563 crate = ":flatbuffers_rs",
564 deps = [
565 ":json_to_flatbuffer_rust_fbs",
566 ],
567)
568
Austin Schuhcb108412019-10-13 16:09:54 -0700569cc_test(
570 name = "configuration_test",
571 srcs = [
572 "configuration_test.cc",
573 ],
574 data = [
Nathan Leong307c9692022-10-08 15:25:03 -0700575 "//aos/events:ping_fbs_reflection_out",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700576 "//aos/events:pingpong_config",
Brian Silvermandae15a12022-07-23 12:55:20 -0700577 "//aos/events:pong_fbs_reflection_out",
James Kuszmaulc0c08da2020-05-10 18:56:07 -0700578 "//aos/testdata:test_configs",
Austin Schuhcb108412019-10-13 16:09:54 -0700579 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800580 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhcb108412019-10-13 16:09:54 -0700581 deps = [
582 ":configuration",
Nathan Leong307c9692022-10-08 15:25:03 -0700583 "//aos/events:ping_fbs",
Austin Schuh1ef01ef2021-02-07 20:40:36 -0800584 "//aos/testing:flatbuffer_eq",
Austin Schuhcb108412019-10-13 16:09:54 -0700585 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -0700586 "//aos/testing:path",
Austin Schuhcb108412019-10-13 16:09:54 -0700587 "//aos/testing:test_logging",
588 ],
589)
Alex Perrycb7da4b2019-08-28 19:35:56 -0700590
591cc_binary(
592 name = "config_flattener",
593 srcs = [
594 "config_flattener.cc",
595 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800596 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700597 visibility = ["//visibility:public"],
598 deps = [
599 ":configuration",
600 ":init",
601 "//aos/util:file",
602 "@com_github_google_glog//:glog",
603 ],
604)
Tyler Chatow5e369a42019-11-23 11:57:31 -0800605
Brian Silvermanea2c95f2021-02-10 18:10:26 -0800606cc_library(
607 name = "aos_cli_utils",
608 srcs = [
609 "aos_cli_utils.cc",
610 ],
611 hdrs = [
612 "aos_cli_utils.h",
613 ],
614 target_compatible_with = ["@platforms//os:linux"],
615 visibility = ["//visibility:public"],
616 deps = [
617 ":configuration",
618 "//aos:init",
619 "//aos/events:shm_event_loop",
Austin Schuh893d7f42022-09-16 15:01:35 -0700620 "//aos/events:simulated_event_loop",
Brian Silvermanea2c95f2021-02-10 18:10:26 -0800621 "@com_github_google_glog//:glog",
622 ],
623)
624
Tyler Chatow5e369a42019-11-23 11:57:31 -0800625cc_binary(
Austin Schuh944df342019-12-21 17:08:55 -0800626 name = "aos_dump",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800627 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -0800628 "aos_dump.cc",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800629 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800630 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800631 visibility = ["//visibility:public"],
632 deps = [
Brian Silvermanea2c95f2021-02-10 18:10:26 -0800633 ":aos_cli_utils",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800634 ":configuration",
635 ":json_to_flatbuffer",
636 "//aos:init",
Brian Silvermanea2c95f2021-02-10 18:10:26 -0800637 "@com_github_google_glog//:glog",
638 ],
639)
640
641cc_binary(
642 name = "aos_send",
643 srcs = [
644 "aos_send.cc",
645 ],
646 target_compatible_with = ["@platforms//os:linux"],
647 visibility = ["//visibility:public"],
648 deps = [
649 ":aos_cli_utils",
650 ":configuration",
651 ":init",
652 ":json_to_flatbuffer",
653 "@com_github_gflags_gflags//:gflags",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800654 "@com_github_google_glog//:glog",
655 ],
656)
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500657
Jim Ostrowski17ce54d2020-10-24 17:24:01 -0700658cc_binary(
659 name = "aos_graph_nodes",
660 srcs = [
661 "aos_graph_nodes.cc",
662 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800663 target_compatible_with = ["@platforms//os:linux"],
Jim Ostrowski17ce54d2020-10-24 17:24:01 -0700664 visibility = ["//visibility:public"],
665 deps = [
666 ":configuration",
667 ":json_to_flatbuffer",
668 "//aos:init",
669 "//aos/events:shm_event_loop",
670 "@com_github_google_glog//:glog",
671 ],
672)
673
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500674cc_library(
675 name = "ftrace",
676 srcs = [
677 "ftrace.cc",
678 ],
679 hdrs = [
680 "ftrace.h",
681 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800682 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500683 visibility = ["//visibility:public"],
684 deps = [
685 "@com_github_google_glog//:glog",
Austin Schuhc9de0132022-12-26 18:04:53 -0800686 "@com_google_absl//absl/strings",
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500687 ],
688)
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700689
690cc_library(
691 name = "fast_string_builder",
692 srcs = [
693 "fast_string_builder.cc",
694 ],
695 hdrs = [
696 "fast_string_builder.h",
697 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800698 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul4ed5fb12022-03-22 15:20:04 -0700699 visibility = ["//visibility:public"],
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700700 deps = [
701 "@com_github_google_glog//:glog",
702 "@com_google_absl//absl/strings",
703 "@com_google_absl//absl/strings:str_format",
704 ],
705)
Brian Silvermanb47f5552020-10-01 15:08:14 -0700706
Austin Schuhcc6070c2020-10-10 20:25:56 -0700707cc_test(
708 name = "realtime_test",
709 srcs = [
710 "realtime_test.cc",
711 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800712 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhcc6070c2020-10-10 20:25:56 -0700713 visibility = ["//visibility:public"],
714 deps = [
Austin Schuh77f3f222022-06-10 16:49:21 -0700715 ":init",
Austin Schuhcc6070c2020-10-10 20:25:56 -0700716 ":realtime",
Austin Schuh77f3f222022-06-10 16:49:21 -0700717 "@com_github_gflags_gflags//:gflags",
718 "@com_github_google_glog//:glog",
719 "@com_google_googletest//:gtest",
Austin Schuhcc6070c2020-10-10 20:25:56 -0700720 ],
721)
Austin Schuh977a5ed2020-12-02 23:20:04 -0800722
723cc_test(
724 name = "flatbuffers_test",
725 srcs = [
726 "flatbuffers_test.cc",
727 ],
728 deps = [
729 ":flatbuffers",
730 ":json_to_flatbuffer",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800731 ":json_to_flatbuffer_fbs",
Austin Schuh977a5ed2020-12-02 23:20:04 -0800732 "//aos/testing:googletest",
davidjevans8b9b52f2021-09-17 08:57:30 -0700733 "//aos/testing:tmpdir",
Austin Schuh977a5ed2020-12-02 23:20:04 -0800734 ],
735)
Austin Schuh0de30f32020-12-06 12:44:28 -0800736
737py_binary(
738 name = "flatbuffers_static",
739 srcs = ["flatbuffers_static.py"],
740 visibility = ["//visibility:public"],
741)
Austin Schuh4385b142021-03-14 21:31:13 -0700742
743cc_library(
744 name = "uuid",
745 srcs = ["uuid.cc"],
746 hdrs = ["uuid.h"],
747 target_compatible_with = ["@platforms//os:linux"],
748 visibility = ["//visibility:public"],
749 deps = [
Austin Schuh8902fa52021-03-14 22:39:24 -0700750 "@com_github_gflags_gflags//:gflags",
Austin Schuh4385b142021-03-14 21:31:13 -0700751 "@com_github_google_flatbuffers//:flatbuffers",
752 "@com_github_google_glog//:glog",
753 "@com_google_absl//absl/types:span",
754 ],
755)
756
757cc_test(
James Kuszmaul05ccb272023-07-13 10:58:14 -0700758 name = "uuid_collision_test",
James Kuszmaula791b762023-07-13 14:56:21 -0700759 timeout = "eternal",
James Kuszmaul05ccb272023-07-13 10:58:14 -0700760 srcs = ["uuid_collision_test.cc"],
James Kuszmaula791b762023-07-13 14:56:21 -0700761 shard_count = 2,
James Kuszmaul05ccb272023-07-13 10:58:14 -0700762 target_compatible_with = ["@platforms//os:linux"],
763 deps = [
764 ":uuid",
765 "//aos/testing:googletest",
766 ],
767)
768
769cc_test(
Austin Schuh4385b142021-03-14 21:31:13 -0700770 name = "uuid_test",
771 srcs = ["uuid_test.cc"],
772 target_compatible_with = ["@platforms//os:linux"],
773 deps = [
774 ":uuid",
775 "//aos/testing:googletest",
776 ],
777)
Austin Schuh30f74292021-08-13 17:25:26 -0700778
Brian Silverman10599932022-08-15 06:05:53 -0700779cc_library(
780 name = "uuid_for_rust",
781 hdrs = ["uuid_for_rust.h"],
782 deps = [
783 ":uuid",
784 ],
785)
786
787autocxx_library(
788 name = "uuid_rs",
789 srcs = ["uuid.rs"],
790 crate_name = "aos_uuid",
791 libs = [
792 ":uuid",
793 ":uuid_for_rust",
794 ],
795 override_cc_toolchain = "@llvm_toolchain//:cc-clang-x86_64-linux",
796 rs_deps = [
Adam Snaider770b97b2023-08-04 21:07:48 -0700797 "@crate_index//:uuid",
Brian Silverman10599932022-08-15 06:05:53 -0700798 ],
Austin Schuhdfa127f2022-10-26 21:17:42 -0700799 target_compatible_with = select({
800 "//conditions:default": ["//tools/platforms/rust:has_support"],
801 "//tools:has_msan": ["@platforms//:incompatible"],
802 }),
Brian Silverman10599932022-08-15 06:05:53 -0700803 visibility = ["//visibility:public"],
804)
805
Austin Schuh30f74292021-08-13 17:25:26 -0700806cc_binary(
807 name = "aos_graph_channels",
808 srcs = [
809 "aos_graph_channels.cc",
810 ],
811 target_compatible_with = ["@platforms//os:linux"],
812 deps = [
813 "//aos:configuration",
814 "//aos:init",
815 "//aos:json_to_flatbuffer",
816 "//aos/events:simulated_event_loop",
817 "//aos/events/logging:log_reader",
818 "//aos/time",
819 "@com_github_gflags_gflags//:gflags",
820 "@com_github_google_glog//:glog",
821 ],
822)
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700823
824cc_library(
825 name = "for_rust",
826 hdrs = [
827 "for_rust.h",
828 ],
829 visibility = ["//visibility:public"],
830 deps = [
Adam Snaider770b97b2023-08-04 21:07:48 -0700831 "@crate_index//:cxx_cc",
Brian Silverman7edd1ce2022-07-23 16:10:54 -0700832 ],
833)
Austin Schuhb0e439d2023-05-15 10:55:40 -0700834
835cc_library(
836 name = "sha256",
837 srcs = [
838 "sha256.cc",
839 ],
840 hdrs = ["sha256.h"],
841 target_compatible_with = ["@platforms//os:linux"],
842 visibility = ["//visibility:public"],
843 deps = [
James Kuszmaul56802ab2023-08-23 15:18:34 -0700844 "//aos/util:file",
Austin Schuhb0e439d2023-05-15 10:55:40 -0700845 "@boringssl//:crypto",
846 "@com_google_absl//absl/types:span",
847 ],
848)
James Kuszmaul56802ab2023-08-23 15:18:34 -0700849
850cc_test(
851 name = "sha256_test",
852 srcs = ["sha256_test.cc"],
853 deps = [
854 ":sha256",
855 "//aos/testing:googletest",
856 "//aos/testing:tmpdir",
857 ],
858)