blob: e6dad818eb8d5103d009949a97969953fa5d2a3f [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 ],
80 # The roborio compiler doesn't support <filesystem>.
81 target_compatible_with =
82 ["@platforms//os:linux"],
83 deps = [
84 ":subprocess",
85 "//aos/events:shm_event_loop",
86 "//aos/testing:googletest",
87 "//aos/testing:path",
88 "//aos/testing:tmpdir",
89 ],
90)
91
92cc_test(
Tyler Chatowa79419d2020-08-12 20:12:11 -070093 name = "starter_test",
94 srcs = ["starter_test.cc"],
95 data = [
James Kuszmaul293b2172021-11-10 16:20:48 -080096 ":multinode_pingpong_config",
Tyler Chatowa79419d2020-08-12 20:12:11 -070097 "//aos/events:ping",
98 "//aos/events:pingpong_config",
99 "//aos/events:pong",
100 ],
James Kuszmaul293b2172021-11-10 16:20:48 -0800101 linkopts = ["-lstdc++fs"],
James Kuszmaule7c7e582022-01-07 18:50:01 -0800102 shard_count = 4,
James Kuszmaul293b2172021-11-10 16:20:48 -0800103 # The roborio compiler doesn't support <filesystem>.
104 target_compatible_with =
105 select({
106 "//tools/platforms/hardware:roborio": ["@platforms//:incompatible"],
107 "//conditions:default": ["@platforms//os:linux"],
108 }),
Tyler Chatowa79419d2020-08-12 20:12:11 -0700109 deps = [
110 ":starter_rpc_lib",
111 ":starterd_lib",
112 "//aos/events:ping_fbs",
113 "//aos/events:pong_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -0800114 "//aos/events:simulated_event_loop",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700115 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -0700116 "//aos/testing:path",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700117 "//aos/testing:tmpdir",
118 ],
119)
120
121cc_binary(
122 name = "starterd",
123 srcs = ["starterd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800124 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700125 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700126 deps = [
127 ":starterd_lib",
128 "//aos:init",
129 ],
130)
131
132cc_library(
133 name = "starter_rpc_lib",
134 srcs = ["starter_rpc_lib.cc"],
135 hdrs = ["starter_rpc_lib.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800136 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul293b2172021-11-10 16:20:48 -0800137 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700138 deps = [
139 ":starter_fbs",
140 ":starter_rpc_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -0800141 ":starterd_lib",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700142 "//aos:configuration",
143 "//aos:init",
144 "//aos/events:shm_event_loop",
145 ],
146)
147
148cc_binary(
Austin Schuh529ac592021-10-14 16:11:13 -0700149 name = "aos_starter",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700150 srcs = ["starter_cmd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800151 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700152 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700153 deps = [
154 ":starter_rpc_lib",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700155 "//aos/time",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700156 "@com_github_google_glog//:glog",
Philipp Schrader08537492021-01-23 16:17:55 -0800157 "@com_google_absl//absl/strings:str_format",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700158 ],
159)
160
161flatbuffer_cc_library(
162 name = "starter_fbs",
163 srcs = ["starter.fbs"],
164 gen_reflections = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800165 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700166 visibility = ["//visibility:public"],
167)
168
169flatbuffer_cc_library(
170 name = "starter_rpc_fbs",
171 srcs = ["starter_rpc.fbs"],
172 gen_reflections = True,
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)
James Kuszmaul77e19812021-05-19 21:36:10 -0700176
177py_binary(
178 name = "starter_demo",
179 srcs = ["starter_demo.py"],
180 args = [
181 "$(rootpath :starterd)",
182 "\"$(rootpaths //aos/events:pingpong_config)\"",
183 "$(rootpath //aos/events:ping)",
184 "$(rootpath //aos/events:pong)",
Austin Schuh529ac592021-10-14 16:11:13 -0700185 "$(rootpath :aos_starter)",
James Kuszmaul77e19812021-05-19 21:36:10 -0700186 ],
187 data = [
Austin Schuh529ac592021-10-14 16:11:13 -0700188 ":aos_starter",
James Kuszmaul77e19812021-05-19 21:36:10 -0700189 ":starterd",
190 "//aos/events:ping",
191 "//aos/events:pingpong_config",
192 "//aos/events:pong",
193 ],
194)