blob: 73353f673f03a456441b25b81cb2d6e6a349ff1a [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(
26 name = "starterd_lib",
27 srcs = ["starterd_lib.cc"],
28 hdrs = ["starterd_lib.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -080029 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -070030 deps = [
31 ":starter_fbs",
32 ":starter_rpc_fbs",
33 "//aos:configuration",
34 "//aos:macros",
35 "//aos/events:shm_event_loop",
36 "@com_github_google_glog//:glog",
37 ],
38)
39
James Kuszmaul293b2172021-11-10 16:20:48 -080040aos_config(
41 name = "multinode_pingpong_config",
42 src = "multinode_pingpong.json",
43 flatbuffers = [
44 "//aos/events:ping_fbs",
45 "//aos/events:pong_fbs",
46 ":starter_rpc_fbs",
47 ":starter_fbs",
48 "//aos/logging:log_message_fbs",
49 "//aos/events:event_loop_fbs",
50 "//aos/network:message_bridge_client_fbs",
51 "//aos/network:remote_message_fbs",
52 "//aos/network:timestamp_fbs",
53 "//aos/network:message_bridge_server_fbs",
54 ],
55 target_compatible_with = ["@platforms//os:linux"],
56)
57
Tyler Chatowa79419d2020-08-12 20:12:11 -070058cc_test(
59 name = "starter_test",
60 srcs = ["starter_test.cc"],
61 data = [
James Kuszmaul293b2172021-11-10 16:20:48 -080062 ":multinode_pingpong_config",
Tyler Chatowa79419d2020-08-12 20:12:11 -070063 "//aos/events:ping",
64 "//aos/events:pingpong_config",
65 "//aos/events:pong",
66 ],
James Kuszmaul293b2172021-11-10 16:20:48 -080067 linkopts = ["-lstdc++fs"],
Austin Schuh5f79a5a2021-10-12 17:46:50 -070068 shard_count = 3,
James Kuszmaul293b2172021-11-10 16:20:48 -080069 # The roborio compiler doesn't support <filesystem>.
70 target_compatible_with =
71 select({
72 "//tools/platforms/hardware:roborio": ["@platforms//:incompatible"],
73 "//conditions:default": ["@platforms//os:linux"],
74 }),
Tyler Chatowa79419d2020-08-12 20:12:11 -070075 deps = [
76 ":starter_rpc_lib",
77 ":starterd_lib",
78 "//aos/events:ping_fbs",
79 "//aos/events:pong_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -080080 "//aos/events:simulated_event_loop",
Tyler Chatowa79419d2020-08-12 20:12:11 -070081 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -070082 "//aos/testing:path",
Tyler Chatowa79419d2020-08-12 20:12:11 -070083 "//aos/testing:tmpdir",
84 ],
85)
86
87cc_binary(
88 name = "starterd",
89 srcs = ["starterd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -080090 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -070091 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -070092 deps = [
93 ":starterd_lib",
94 "//aos:init",
95 ],
96)
97
98cc_library(
99 name = "starter_rpc_lib",
100 srcs = ["starter_rpc_lib.cc"],
101 hdrs = ["starter_rpc_lib.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800102 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul293b2172021-11-10 16:20:48 -0800103 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700104 deps = [
105 ":starter_fbs",
106 ":starter_rpc_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -0800107 ":starterd_lib",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700108 "//aos:configuration",
109 "//aos:init",
110 "//aos/events:shm_event_loop",
111 ],
112)
113
114cc_binary(
Austin Schuh529ac592021-10-14 16:11:13 -0700115 name = "aos_starter",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700116 srcs = ["starter_cmd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800117 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700118 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700119 deps = [
120 ":starter_rpc_lib",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700121 "//aos/time",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700122 "@com_github_google_glog//:glog",
Philipp Schrader08537492021-01-23 16:17:55 -0800123 "@com_google_absl//absl/strings:str_format",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700124 ],
125)
126
127flatbuffer_cc_library(
128 name = "starter_fbs",
129 srcs = ["starter.fbs"],
130 gen_reflections = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800131 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700132 visibility = ["//visibility:public"],
133)
134
135flatbuffer_cc_library(
136 name = "starter_rpc_fbs",
137 srcs = ["starter_rpc.fbs"],
138 gen_reflections = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800139 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700140 visibility = ["//visibility:public"],
141)
James Kuszmaul77e19812021-05-19 21:36:10 -0700142
143py_binary(
144 name = "starter_demo",
145 srcs = ["starter_demo.py"],
146 args = [
147 "$(rootpath :starterd)",
148 "\"$(rootpaths //aos/events:pingpong_config)\"",
149 "$(rootpath //aos/events:ping)",
150 "$(rootpath //aos/events:pong)",
Austin Schuh529ac592021-10-14 16:11:13 -0700151 "$(rootpath :aos_starter)",
James Kuszmaul77e19812021-05-19 21:36:10 -0700152 ],
153 data = [
Austin Schuh529ac592021-10-14 16:11:13 -0700154 ":aos_starter",
James Kuszmaul77e19812021-05-19 21:36:10 -0700155 ":starterd",
156 "//aos/events:ping",
157 "//aos/events:pingpong_config",
158 "//aos/events:pong",
159 ],
160)