blob: f998a935e354d26a7e65bde290f73f8729212bc9 [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(
75 name = "starter_test",
76 srcs = ["starter_test.cc"],
77 data = [
James Kuszmaul293b2172021-11-10 16:20:48 -080078 ":multinode_pingpong_config",
Tyler Chatowa79419d2020-08-12 20:12:11 -070079 "//aos/events:ping",
80 "//aos/events:pingpong_config",
81 "//aos/events:pong",
82 ],
James Kuszmaul293b2172021-11-10 16:20:48 -080083 linkopts = ["-lstdc++fs"],
James Kuszmaule7c7e582022-01-07 18:50:01 -080084 shard_count = 4,
James Kuszmaul293b2172021-11-10 16:20:48 -080085 # The roborio compiler doesn't support <filesystem>.
86 target_compatible_with =
87 select({
88 "//tools/platforms/hardware:roborio": ["@platforms//:incompatible"],
89 "//conditions:default": ["@platforms//os:linux"],
90 }),
Tyler Chatowa79419d2020-08-12 20:12:11 -070091 deps = [
92 ":starter_rpc_lib",
93 ":starterd_lib",
94 "//aos/events:ping_fbs",
95 "//aos/events:pong_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -080096 "//aos/events:simulated_event_loop",
Tyler Chatowa79419d2020-08-12 20:12:11 -070097 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -070098 "//aos/testing:path",
Tyler Chatowa79419d2020-08-12 20:12:11 -070099 "//aos/testing:tmpdir",
100 ],
101)
102
103cc_binary(
104 name = "starterd",
105 srcs = ["starterd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800106 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700107 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700108 deps = [
109 ":starterd_lib",
110 "//aos:init",
111 ],
112)
113
114cc_library(
115 name = "starter_rpc_lib",
116 srcs = ["starter_rpc_lib.cc"],
117 hdrs = ["starter_rpc_lib.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800118 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul293b2172021-11-10 16:20:48 -0800119 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700120 deps = [
121 ":starter_fbs",
122 ":starter_rpc_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -0800123 ":starterd_lib",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700124 "//aos:configuration",
125 "//aos:init",
126 "//aos/events:shm_event_loop",
127 ],
128)
129
130cc_binary(
Austin Schuh529ac592021-10-14 16:11:13 -0700131 name = "aos_starter",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700132 srcs = ["starter_cmd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800133 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700134 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700135 deps = [
136 ":starter_rpc_lib",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700137 "//aos/time",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700138 "@com_github_google_glog//:glog",
Philipp Schrader08537492021-01-23 16:17:55 -0800139 "@com_google_absl//absl/strings:str_format",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700140 ],
141)
142
143flatbuffer_cc_library(
144 name = "starter_fbs",
145 srcs = ["starter.fbs"],
146 gen_reflections = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800147 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700148 visibility = ["//visibility:public"],
149)
150
151flatbuffer_cc_library(
152 name = "starter_rpc_fbs",
153 srcs = ["starter_rpc.fbs"],
154 gen_reflections = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800155 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700156 visibility = ["//visibility:public"],
157)
James Kuszmaul77e19812021-05-19 21:36:10 -0700158
159py_binary(
160 name = "starter_demo",
161 srcs = ["starter_demo.py"],
162 args = [
163 "$(rootpath :starterd)",
164 "\"$(rootpaths //aos/events:pingpong_config)\"",
165 "$(rootpath //aos/events:ping)",
166 "$(rootpath //aos/events:pong)",
Austin Schuh529ac592021-10-14 16:11:13 -0700167 "$(rootpath :aos_starter)",
James Kuszmaul77e19812021-05-19 21:36:10 -0700168 ],
169 data = [
Austin Schuh529ac592021-10-14 16:11:13 -0700170 ":aos_starter",
James Kuszmaul77e19812021-05-19 21:36:10 -0700171 ":starterd",
172 "//aos/events:ping",
173 "//aos/events:pingpong_config",
174 "//aos/events:pong",
175 ],
176)