blob: 2186421e4097b498b7f625ffce2e257883d5f462 [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
Brian Silverman96d12952015-10-12 13:36:42 -04004# This target is everything which should get deployed to the robot.
5filegroup(
Austin Schuhdde64052019-12-11 20:28:00 -08006 name = "starter",
7 srcs = [
Austin Schuh529ac592021-10-14 16:11:13 -07008 "aos_starter",
Austin Schuhdde64052019-12-11 20:28:00 -08009 "starter.sh",
Austin Schuh44e0b142021-10-16 15:51:10 -070010 "starterd.stripped",
11 ],
12 visibility = ["//visibility:public"],
13)
14
15filegroup(
16 name = "starter_stripped",
17 srcs = [
18 "aos_starter.stripped",
19 "starter.sh",
20 "starterd.stripped",
Austin Schuhdde64052019-12-11 20:28:00 -080021 ],
22 visibility = ["//visibility:public"],
Brian Silverman96d12952015-10-12 13:36:42 -040023)
Brian Silverman100534c2015-09-07 15:51:23 -040024
Tyler Chatowa79419d2020-08-12 20:12:11 -070025cc_library(
James Kuszmaul3224b8e2022-01-07 19:00:39 -080026 name = "subprocess",
27 srcs = ["subprocess.cc"],
28 hdrs = ["subprocess.h"],
29 visibility = ["//visibility:public"],
30 deps = [
31 ":starter_fbs",
32 ":starter_rpc_fbs",
33 "//aos/events:event_loop",
34 "//aos/events:shm_event_loop",
35 "//aos/util:scoped_pipe",
36 "@com_github_google_glog//:glog",
37 ],
38)
39
40cc_library(
Tyler Chatowa79419d2020-08-12 20:12:11 -070041 name = "starterd_lib",
42 srcs = ["starterd_lib.cc"],
43 hdrs = ["starterd_lib.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -080044 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -070045 deps = [
46 ":starter_fbs",
47 ":starter_rpc_fbs",
James Kuszmaul3224b8e2022-01-07 19:00:39 -080048 ":subprocess",
Tyler Chatowa79419d2020-08-12 20:12:11 -070049 "//aos:configuration",
50 "//aos:macros",
51 "//aos/events:shm_event_loop",
52 "@com_github_google_glog//:glog",
53 ],
54)
55
James Kuszmaul293b2172021-11-10 16:20:48 -080056aos_config(
57 name = "multinode_pingpong_config",
58 src = "multinode_pingpong.json",
59 flatbuffers = [
60 "//aos/events:ping_fbs",
61 "//aos/events:pong_fbs",
62 ":starter_rpc_fbs",
63 ":starter_fbs",
64 "//aos/logging:log_message_fbs",
65 "//aos/events:event_loop_fbs",
66 "//aos/network:message_bridge_client_fbs",
67 "//aos/network:remote_message_fbs",
68 "//aos/network:timestamp_fbs",
69 "//aos/network:message_bridge_server_fbs",
70 ],
71 target_compatible_with = ["@platforms//os:linux"],
72)
73
Tyler Chatowa79419d2020-08-12 20:12:11 -070074cc_test(
James Kuszmauld42edb42022-01-07 18:00:16 -080075 name = "subprocess_test",
76 srcs = ["subprocess_test.cc"],
77 data = [
78 "//aos/events:pingpong_config",
79 ],
James Kuszmaula03bdf02022-02-26 16:39:45 -080080 flaky = True,
James Kuszmauld42edb42022-01-07 18:00:16 -080081 # The roborio compiler doesn't support <filesystem>.
82 target_compatible_with =
83 ["@platforms//os:linux"],
84 deps = [
85 ":subprocess",
86 "//aos/events:shm_event_loop",
87 "//aos/testing:googletest",
88 "//aos/testing:path",
89 "//aos/testing:tmpdir",
90 ],
91)
92
93cc_test(
Tyler Chatowa79419d2020-08-12 20:12:11 -070094 name = "starter_test",
95 srcs = ["starter_test.cc"],
96 data = [
James Kuszmaul293b2172021-11-10 16:20:48 -080097 ":multinode_pingpong_config",
Tyler Chatowa79419d2020-08-12 20:12:11 -070098 "//aos/events:ping",
99 "//aos/events:pingpong_config",
100 "//aos/events:pong",
101 ],
James Kuszmaul293b2172021-11-10 16:20:48 -0800102 linkopts = ["-lstdc++fs"],
James Kuszmaule7c7e582022-01-07 18:50:01 -0800103 shard_count = 4,
James Kuszmaul293b2172021-11-10 16:20:48 -0800104 # The roborio compiler doesn't support <filesystem>.
105 target_compatible_with =
106 select({
107 "//tools/platforms/hardware:roborio": ["@platforms//:incompatible"],
108 "//conditions:default": ["@platforms//os:linux"],
109 }),
Tyler Chatowa79419d2020-08-12 20:12:11 -0700110 deps = [
111 ":starter_rpc_lib",
112 ":starterd_lib",
113 "//aos/events:ping_fbs",
114 "//aos/events:pong_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -0800115 "//aos/events:simulated_event_loop",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700116 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -0700117 "//aos/testing:path",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700118 "//aos/testing:tmpdir",
119 ],
120)
121
122cc_binary(
123 name = "starterd",
124 srcs = ["starterd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800125 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700126 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700127 deps = [
128 ":starterd_lib",
129 "//aos:init",
130 ],
131)
132
133cc_library(
134 name = "starter_rpc_lib",
135 srcs = ["starter_rpc_lib.cc"],
136 hdrs = ["starter_rpc_lib.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800137 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul293b2172021-11-10 16:20:48 -0800138 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700139 deps = [
140 ":starter_fbs",
141 ":starter_rpc_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -0800142 ":starterd_lib",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700143 "//aos:configuration",
144 "//aos:init",
145 "//aos/events:shm_event_loop",
146 ],
147)
148
149cc_binary(
Austin Schuh529ac592021-10-14 16:11:13 -0700150 name = "aos_starter",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700151 srcs = ["starter_cmd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800152 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700153 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700154 deps = [
155 ":starter_rpc_lib",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700156 "//aos/time",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700157 "@com_github_google_glog//:glog",
Philipp Schrader08537492021-01-23 16:17:55 -0800158 "@com_google_absl//absl/strings:str_format",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700159 ],
160)
161
162flatbuffer_cc_library(
163 name = "starter_fbs",
164 srcs = ["starter.fbs"],
165 gen_reflections = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800166 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700167 visibility = ["//visibility:public"],
168)
169
170flatbuffer_cc_library(
171 name = "starter_rpc_fbs",
172 srcs = ["starter_rpc.fbs"],
173 gen_reflections = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800174 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700175 visibility = ["//visibility:public"],
176)
James Kuszmaul77e19812021-05-19 21:36:10 -0700177
178py_binary(
179 name = "starter_demo",
180 srcs = ["starter_demo.py"],
181 args = [
182 "$(rootpath :starterd)",
183 "\"$(rootpaths //aos/events:pingpong_config)\"",
184 "$(rootpath //aos/events:ping)",
185 "$(rootpath //aos/events:pong)",
Austin Schuh529ac592021-10-14 16:11:13 -0700186 "$(rootpath :aos_starter)",
James Kuszmaul77e19812021-05-19 21:36:10 -0700187 ],
188 data = [
Austin Schuh529ac592021-10-14 16:11:13 -0700189 ":aos_starter",
James Kuszmaul77e19812021-05-19 21:36:10 -0700190 ":starterd",
191 "//aos/events:ping",
192 "//aos/events:pingpong_config",
193 "//aos/events:pong",
194 ],
195)