blob: d4566a062c8b18d7143eaabf74a6c94ef4d11c1e [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",
James Kuszmaul6295a642022-03-22 15:23:59 -070036 "//aos/util:top",
James Kuszmaul3224b8e2022-01-07 19:00:39 -080037 "@com_github_google_glog//:glog",
38 ],
39)
40
41cc_library(
Tyler Chatowa79419d2020-08-12 20:12:11 -070042 name = "starterd_lib",
43 srcs = ["starterd_lib.cc"],
44 hdrs = ["starterd_lib.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -080045 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -070046 deps = [
47 ":starter_fbs",
48 ":starter_rpc_fbs",
James Kuszmaul3224b8e2022-01-07 19:00:39 -080049 ":subprocess",
Tyler Chatowa79419d2020-08-12 20:12:11 -070050 "//aos:configuration",
51 "//aos:macros",
52 "//aos/events:shm_event_loop",
53 "@com_github_google_glog//:glog",
54 ],
55)
56
James Kuszmaul293b2172021-11-10 16:20:48 -080057aos_config(
58 name = "multinode_pingpong_config",
59 src = "multinode_pingpong.json",
60 flatbuffers = [
61 "//aos/events:ping_fbs",
62 "//aos/events:pong_fbs",
63 ":starter_rpc_fbs",
64 ":starter_fbs",
65 "//aos/logging:log_message_fbs",
66 "//aos/events:event_loop_fbs",
67 "//aos/network:message_bridge_client_fbs",
68 "//aos/network:remote_message_fbs",
69 "//aos/network:timestamp_fbs",
70 "//aos/network:message_bridge_server_fbs",
71 ],
72 target_compatible_with = ["@platforms//os:linux"],
73)
74
Tyler Chatowa79419d2020-08-12 20:12:11 -070075cc_test(
James Kuszmauld42edb42022-01-07 18:00:16 -080076 name = "subprocess_test",
77 srcs = ["subprocess_test.cc"],
78 data = [
79 "//aos/events:pingpong_config",
80 ],
James Kuszmaula03bdf02022-02-26 16:39:45 -080081 flaky = True,
James Kuszmauld42edb42022-01-07 18:00:16 -080082 # The roborio compiler doesn't support <filesystem>.
83 target_compatible_with =
84 ["@platforms//os:linux"],
85 deps = [
86 ":subprocess",
87 "//aos/events:shm_event_loop",
88 "//aos/testing:googletest",
89 "//aos/testing:path",
90 "//aos/testing:tmpdir",
91 ],
92)
93
94cc_test(
Tyler Chatowa79419d2020-08-12 20:12:11 -070095 name = "starter_test",
96 srcs = ["starter_test.cc"],
97 data = [
James Kuszmaul293b2172021-11-10 16:20:48 -080098 ":multinode_pingpong_config",
Tyler Chatowa79419d2020-08-12 20:12:11 -070099 "//aos/events:ping",
100 "//aos/events:pingpong_config",
101 "//aos/events:pong",
102 ],
James Kuszmaulbe55e1c2022-04-02 20:06:01 -0700103 # TODO(james): Fix tihs.
104 flaky = True,
James Kuszmaul293b2172021-11-10 16:20:48 -0800105 linkopts = ["-lstdc++fs"],
James Kuszmaule7c7e582022-01-07 18:50:01 -0800106 shard_count = 4,
James Kuszmaul293b2172021-11-10 16:20:48 -0800107 # The roborio compiler doesn't support <filesystem>.
108 target_compatible_with =
109 select({
110 "//tools/platforms/hardware:roborio": ["@platforms//:incompatible"],
111 "//conditions:default": ["@platforms//os:linux"],
112 }),
Tyler Chatowa79419d2020-08-12 20:12:11 -0700113 deps = [
114 ":starter_rpc_lib",
115 ":starterd_lib",
116 "//aos/events:ping_fbs",
117 "//aos/events:pong_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -0800118 "//aos/events:simulated_event_loop",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700119 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -0700120 "//aos/testing:path",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700121 "//aos/testing:tmpdir",
122 ],
123)
124
125cc_binary(
126 name = "starterd",
127 srcs = ["starterd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800128 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700129 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700130 deps = [
131 ":starterd_lib",
132 "//aos:init",
133 ],
134)
135
136cc_library(
137 name = "starter_rpc_lib",
138 srcs = ["starter_rpc_lib.cc"],
139 hdrs = ["starter_rpc_lib.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800140 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul293b2172021-11-10 16:20:48 -0800141 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700142 deps = [
143 ":starter_fbs",
144 ":starter_rpc_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -0800145 ":starterd_lib",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700146 "//aos:configuration",
147 "//aos:init",
148 "//aos/events:shm_event_loop",
149 ],
150)
151
152cc_binary(
Austin Schuh529ac592021-10-14 16:11:13 -0700153 name = "aos_starter",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700154 srcs = ["starter_cmd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800155 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700156 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700157 deps = [
158 ":starter_rpc_lib",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700159 "//aos/time",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700160 "@com_github_google_glog//:glog",
Philipp Schrader08537492021-01-23 16:17:55 -0800161 "@com_google_absl//absl/strings:str_format",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700162 ],
163)
164
165flatbuffer_cc_library(
166 name = "starter_fbs",
167 srcs = ["starter.fbs"],
168 gen_reflections = True,
James Kuszmaul6295a642022-03-22 15:23:59 -0700169 includes = ["//aos/util:process_info_fbs_includes"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800170 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700171 visibility = ["//visibility:public"],
172)
173
174flatbuffer_cc_library(
175 name = "starter_rpc_fbs",
176 srcs = ["starter_rpc.fbs"],
177 gen_reflections = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800178 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700179 visibility = ["//visibility:public"],
180)
James Kuszmaul77e19812021-05-19 21:36:10 -0700181
182py_binary(
183 name = "starter_demo",
184 srcs = ["starter_demo.py"],
185 args = [
186 "$(rootpath :starterd)",
187 "\"$(rootpaths //aos/events:pingpong_config)\"",
188 "$(rootpath //aos/events:ping)",
189 "$(rootpath //aos/events:pong)",
Austin Schuh529ac592021-10-14 16:11:13 -0700190 "$(rootpath :aos_starter)",
Austin Schuh48d10d62022-10-16 22:19:23 -0700191 "$(rootpath //aos:aos_dump)",
192 "$(rootpath //aos/events/logging:logger_main)",
James Kuszmaul77e19812021-05-19 21:36:10 -0700193 ],
194 data = [
Austin Schuh529ac592021-10-14 16:11:13 -0700195 ":aos_starter",
James Kuszmaul77e19812021-05-19 21:36:10 -0700196 ":starterd",
Austin Schuh48d10d62022-10-16 22:19:23 -0700197 "//aos:aos_dump",
James Kuszmaul77e19812021-05-19 21:36:10 -0700198 "//aos/events:ping",
199 "//aos/events:pingpong_config",
200 "//aos/events:pong",
Austin Schuh48d10d62022-10-16 22:19:23 -0700201 "//aos/events/logging:logger_main",
James Kuszmaul77e19812021-05-19 21:36:10 -0700202 ],
203)