blob: 7ef3777a17a00393f85b8ea65a3f5708076c50ff [file] [log] [blame]
Tyler Chatowa79419d2020-08-12 20:12:11 -07001load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
James Kuszmaul293b2172021-11-10 16:20:48 -08002load("//aos:config.bzl", "aos_config")
Tyler Chatowa79419d2020-08-12 20:12:11 -07003
Xander Yee1ad2f7b2023-02-21 14:46:56 -08004exports_files(["roborio_irq_config.json"])
5
Brian Silverman96d12952015-10-12 13:36:42 -04006# This target is everything which should get deployed to the robot.
7filegroup(
Austin Schuhdde64052019-12-11 20:28:00 -08008 name = "starter",
9 srcs = [
Austin Schuh529ac592021-10-14 16:11:13 -070010 "aos_starter",
Austin Schuhdde64052019-12-11 20:28:00 -080011 "starter.sh",
Austin Schuh44e0b142021-10-16 15:51:10 -070012 "starterd.stripped",
13 ],
14 visibility = ["//visibility:public"],
15)
16
17filegroup(
18 name = "starter_stripped",
19 srcs = [
20 "aos_starter.stripped",
21 "starter.sh",
22 "starterd.stripped",
Austin Schuhdde64052019-12-11 20:28:00 -080023 ],
24 visibility = ["//visibility:public"],
Brian Silverman96d12952015-10-12 13:36:42 -040025)
Brian Silverman100534c2015-09-07 15:51:23 -040026
Tyler Chatowa79419d2020-08-12 20:12:11 -070027cc_library(
James Kuszmaul3224b8e2022-01-07 19:00:39 -080028 name = "subprocess",
29 srcs = ["subprocess.cc"],
30 hdrs = ["subprocess.h"],
31 visibility = ["//visibility:public"],
32 deps = [
33 ":starter_fbs",
34 ":starter_rpc_fbs",
35 "//aos/events:event_loop",
36 "//aos/events:shm_event_loop",
37 "//aos/util:scoped_pipe",
James Kuszmaul6295a642022-03-22 15:23:59 -070038 "//aos/util:top",
James Kuszmaul3224b8e2022-01-07 19:00:39 -080039 "@com_github_google_glog//:glog",
40 ],
41)
42
43cc_library(
Tyler Chatowa79419d2020-08-12 20:12:11 -070044 name = "starterd_lib",
45 srcs = ["starterd_lib.cc"],
46 hdrs = ["starterd_lib.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -080047 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -070048 deps = [
49 ":starter_fbs",
50 ":starter_rpc_fbs",
James Kuszmaul3224b8e2022-01-07 19:00:39 -080051 ":subprocess",
Tyler Chatowa79419d2020-08-12 20:12:11 -070052 "//aos:configuration",
53 "//aos:macros",
54 "//aos/events:shm_event_loop",
55 "@com_github_google_glog//:glog",
56 ],
57)
58
James Kuszmaul293b2172021-11-10 16:20:48 -080059aos_config(
60 name = "multinode_pingpong_config",
61 src = "multinode_pingpong.json",
62 flatbuffers = [
63 "//aos/events:ping_fbs",
64 "//aos/events:pong_fbs",
65 ":starter_rpc_fbs",
66 ":starter_fbs",
67 "//aos/logging:log_message_fbs",
68 "//aos/events:event_loop_fbs",
69 "//aos/network:message_bridge_client_fbs",
70 "//aos/network:remote_message_fbs",
71 "//aos/network:timestamp_fbs",
72 "//aos/network:message_bridge_server_fbs",
73 ],
74 target_compatible_with = ["@platforms//os:linux"],
75)
76
Tyler Chatowa79419d2020-08-12 20:12:11 -070077cc_test(
James Kuszmauld42edb42022-01-07 18:00:16 -080078 name = "subprocess_test",
79 srcs = ["subprocess_test.cc"],
80 data = [
81 "//aos/events:pingpong_config",
82 ],
James Kuszmaula03bdf02022-02-26 16:39:45 -080083 flaky = True,
James Kuszmauld42edb42022-01-07 18:00:16 -080084 # The roborio compiler doesn't support <filesystem>.
85 target_compatible_with =
86 ["@platforms//os:linux"],
87 deps = [
88 ":subprocess",
89 "//aos/events:shm_event_loop",
90 "//aos/testing:googletest",
91 "//aos/testing:path",
92 "//aos/testing:tmpdir",
93 ],
94)
95
96cc_test(
Tyler Chatowa79419d2020-08-12 20:12:11 -070097 name = "starter_test",
98 srcs = ["starter_test.cc"],
99 data = [
James Kuszmaul293b2172021-11-10 16:20:48 -0800100 ":multinode_pingpong_config",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700101 "//aos/events:ping",
102 "//aos/events:pingpong_config",
103 "//aos/events:pong",
104 ],
James Kuszmaulbe55e1c2022-04-02 20:06:01 -0700105 # TODO(james): Fix tihs.
106 flaky = True,
James Kuszmaul293b2172021-11-10 16:20:48 -0800107 linkopts = ["-lstdc++fs"],
James Kuszmaule7c7e582022-01-07 18:50:01 -0800108 shard_count = 4,
James Kuszmaul293b2172021-11-10 16:20:48 -0800109 # The roborio compiler doesn't support <filesystem>.
110 target_compatible_with =
111 select({
112 "//tools/platforms/hardware:roborio": ["@platforms//:incompatible"],
113 "//conditions:default": ["@platforms//os:linux"],
114 }),
Tyler Chatowa79419d2020-08-12 20:12:11 -0700115 deps = [
116 ":starter_rpc_lib",
117 ":starterd_lib",
118 "//aos/events:ping_fbs",
119 "//aos/events:pong_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -0800120 "//aos/events:simulated_event_loop",
Austin Schuh59398d32023-05-03 08:10:55 -0700121 "//aos/ipc_lib:event",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700122 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -0700123 "//aos/testing:path",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700124 "//aos/testing:tmpdir",
125 ],
126)
127
128cc_binary(
129 name = "starterd",
130 srcs = ["starterd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800131 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700132 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700133 deps = [
134 ":starterd_lib",
135 "//aos:init",
136 ],
137)
138
139cc_library(
140 name = "starter_rpc_lib",
141 srcs = ["starter_rpc_lib.cc"],
142 hdrs = ["starter_rpc_lib.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800143 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul293b2172021-11-10 16:20:48 -0800144 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700145 deps = [
146 ":starter_fbs",
147 ":starter_rpc_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -0800148 ":starterd_lib",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700149 "//aos:configuration",
150 "//aos:init",
151 "//aos/events:shm_event_loop",
152 ],
153)
154
155cc_binary(
Austin Schuh529ac592021-10-14 16:11:13 -0700156 name = "aos_starter",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700157 srcs = ["starter_cmd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800158 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700159 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700160 deps = [
161 ":starter_rpc_lib",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700162 "//aos/time",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700163 "@com_github_google_glog//:glog",
Philipp Schrader08537492021-01-23 16:17:55 -0800164 "@com_google_absl//absl/strings:str_format",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700165 ],
166)
167
168flatbuffer_cc_library(
169 name = "starter_fbs",
170 srcs = ["starter.fbs"],
171 gen_reflections = True,
James Kuszmaul6295a642022-03-22 15:23:59 -0700172 includes = ["//aos/util:process_info_fbs_includes"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800173 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700174 visibility = ["//visibility:public"],
175)
176
177flatbuffer_cc_library(
Austin Schuh608514f2022-12-30 15:51:30 -0800178 name = "kthread_fbs",
179 srcs = ["kthread.fbs"],
180 gen_reflections = True,
181 target_compatible_with = ["@platforms//os:linux"],
182 visibility = ["//visibility:public"],
183)
184
185flatbuffer_cc_library(
Tyler Chatowa79419d2020-08-12 20:12:11 -0700186 name = "starter_rpc_fbs",
187 srcs = ["starter_rpc.fbs"],
188 gen_reflections = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800189 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700190 visibility = ["//visibility:public"],
191)
James Kuszmaul77e19812021-05-19 21:36:10 -0700192
193py_binary(
194 name = "starter_demo",
195 srcs = ["starter_demo.py"],
196 args = [
197 "$(rootpath :starterd)",
198 "\"$(rootpaths //aos/events:pingpong_config)\"",
199 "$(rootpath //aos/events:ping)",
200 "$(rootpath //aos/events:pong)",
Austin Schuh529ac592021-10-14 16:11:13 -0700201 "$(rootpath :aos_starter)",
Austin Schuh48d10d62022-10-16 22:19:23 -0700202 "$(rootpath //aos:aos_dump)",
203 "$(rootpath //aos/events/logging:logger_main)",
James Kuszmaul77e19812021-05-19 21:36:10 -0700204 ],
205 data = [
Austin Schuh529ac592021-10-14 16:11:13 -0700206 ":aos_starter",
James Kuszmaul77e19812021-05-19 21:36:10 -0700207 ":starterd",
Austin Schuh48d10d62022-10-16 22:19:23 -0700208 "//aos:aos_dump",
James Kuszmaul77e19812021-05-19 21:36:10 -0700209 "//aos/events:ping",
210 "//aos/events:pingpong_config",
211 "//aos/events:pong",
Austin Schuh48d10d62022-10-16 22:19:23 -0700212 "//aos/events/logging:logger_main",
James Kuszmaul77e19812021-05-19 21:36:10 -0700213 ],
214)
Austin Schuh2ec71fd2022-12-30 14:48:59 -0800215
216cc_library(
217 name = "irq_affinity_lib",
218 srcs = ["irq_affinity_lib.cc"],
219 hdrs = ["irq_affinity_lib.h"],
220 deps = [
221 "//aos/scoped:scoped_fd",
222 "@com_github_google_glog//:glog",
223 "@com_google_absl//absl/strings",
224 ],
225)
226
Austin Schuh608514f2022-12-30 15:51:30 -0800227cc_binary(
228 name = "irq_affinity",
229 srcs = [
230 "irq_affinity.cc",
231 ],
Austin Schuh9f164e92022-12-29 16:15:28 -0800232 visibility = ["//visibility:public"],
Austin Schuh608514f2022-12-30 15:51:30 -0800233 deps = [
234 ":irq_affinity_lib",
235 ":kthread_fbs",
236 "//aos:init",
237 "//aos:realtime",
238 "//aos/events:shm_event_loop",
239 "//aos/util:top",
240 ],
241)
242
Austin Schuh2ec71fd2022-12-30 14:48:59 -0800243cc_test(
244 name = "irq_affinity_lib_test",
245 srcs = ["irq_affinity_lib_test.cc"],
246 deps = [
247 ":irq_affinity_lib",
248 "//aos/testing:googletest",
249 ],
250)
James Kuszmaul9a816a72023-03-23 15:10:34 -0700251
252cc_library(
253 name = "mock_starter",
254 srcs = ["mock_starter.cc"],
255 hdrs = ["mock_starter.h"],
256 visibility = ["//visibility:public"],
257 deps = [
258 "//aos/events:simulated_event_loop",
259 "//aos/starter:starter_fbs",
260 "//aos/starter:starter_rpc_fbs",
261 "//aos/starter:starter_rpc_lib",
262 ],
263)