blob: 1f7a3d7454c9dfb15ea4548fbef8844e4b333dbe [file] [log] [blame]
Alex Perry5f474f22020-02-01 12:14:24 -08001load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_ts_library")
Austin Schuh6b9c4152019-11-29 12:45:24 -08002load("//aos:config.bzl", "aos_config")
Alex Perrycb7da4b2019-08-28 19:35:56 -07003
4package(default_visibility = ["//visibility:public"])
5
6flatbuffer_cc_library(
7 name = "test_message_fbs",
8 srcs = ["test_message.fbs"],
9 gen_reflections = 1,
10)
11
12flatbuffer_cc_library(
Austin Schuhe4106142019-12-01 18:19:53 -080013 name = "event_loop_fbs",
14 srcs = ["event_loop.fbs"],
15 gen_reflections = 1,
16 includes = [
17 "//aos:configuration_fbs_includes",
18 ],
19)
20
21flatbuffer_cc_library(
Austin Schuh6b9c4152019-11-29 12:45:24 -080022 name = "ping_fbs",
23 srcs = ["ping.fbs"],
24 gen_reflections = 1,
25)
26
Alex Perry5f474f22020-02-01 12:14:24 -080027flatbuffer_ts_library(
28 name = "ping_ts_fbs",
29 srcs = ["ping.fbs"],
30)
31
Austin Schuh6b9c4152019-11-29 12:45:24 -080032flatbuffer_cc_library(
33 name = "pong_fbs",
34 srcs = ["pong.fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070035 gen_reflections = 1,
36)
37
Parker Schuhe4a70d62017-12-27 20:10:20 -080038cc_library(
Austin Schuh6b6dfa52019-06-12 20:16:20 -070039 name = "epoll",
40 srcs = ["epoll.cc"],
41 hdrs = ["epoll.h"],
Austin Schuh20b2b082019-09-11 20:42:56 -070042 visibility = ["//visibility:public"],
Austin Schuh6b6dfa52019-06-12 20:16:20 -070043 deps = [
Austin Schuh6b6dfa52019-06-12 20:16:20 -070044 "//aos/time",
Austin Schuhf257f3c2019-10-27 21:00:43 -070045 "@com_github_google_glog//:glog",
Austin Schuh6b6dfa52019-06-12 20:16:20 -070046 ],
47)
48
Brian Silverman441591b2020-01-31 17:44:32 -080049cc_test(
50 name = "epoll_test",
51 srcs = ["epoll_test.cc"],
52 deps = [
53 ":epoll",
54 "//aos/testing:googletest",
55 "@com_github_google_glog//:glog",
56 ],
57)
58
Austin Schuh6b6dfa52019-06-12 20:16:20 -070059cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -070060 name = "event_loop",
Austin Schuh54cf95f2019-11-29 13:14:18 -080061 srcs = [
62 "event_loop.cc",
Austin Schuh7d87b672019-12-01 20:23:49 -080063 "event_loop_event.h",
Austin Schuh54cf95f2019-11-29 13:14:18 -080064 "event_loop_tmpl.h",
65 ],
Austin Schuha1654ed2019-01-27 17:24:54 -080066 hdrs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070067 "event_loop.h",
Austin Schuha1654ed2019-01-27 17:24:54 -080068 ],
69 visibility = ["//visibility:public"],
70 deps = [
Austin Schuh39788ff2019-12-01 18:22:57 -080071 ":event_loop_fbs",
72 ":timing_statistics",
Alex Perrycb7da4b2019-08-28 19:35:56 -070073 "//aos:configuration",
74 "//aos:configuration_fbs",
75 "//aos:flatbuffers",
Brian Silvermana1652f32020-01-29 20:41:44 -080076 "//aos/ipc_lib:data_alignment",
Tyler Chatow67ddb032020-01-12 14:30:04 -080077 "//aos/logging:implementations",
Austin Schuha1654ed2019-01-27 17:24:54 -080078 "//aos/time",
Austin Schuh39788ff2019-12-01 18:22:57 -080079 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -070080 "@com_github_google_flatbuffers//:flatbuffers",
Brian Silverman0fc69932020-01-24 21:54:02 -080081 "@com_google_absl//absl/container:btree",
Alex Perrycb7da4b2019-08-28 19:35:56 -070082 ],
83)
84
Austin Schuh6b9c4152019-11-29 12:45:24 -080085cc_library(
86 name = "ping_lib",
87 srcs = [
88 "ping_lib.cc",
89 ],
90 hdrs = [
91 "ping_lib.h",
92 ],
93 deps = [
94 ":event_loop",
95 ":ping_fbs",
96 ":pong_fbs",
97 "//aos:json_to_flatbuffer",
98 "@com_github_google_glog//:glog",
99 ],
100)
101
Alex Perrycb7da4b2019-08-28 19:35:56 -0700102cc_binary(
103 name = "ping",
104 srcs = [
105 "ping.cc",
106 ],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800107 data = ["pingpong_config.json"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700108 deps = [
Austin Schuh6b9c4152019-11-29 12:45:24 -0800109 ":ping_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700110 ":shm_event_loop",
111 "//aos:configuration",
112 "//aos:init",
113 "//aos:json_to_flatbuffer",
114 "@com_github_google_glog//:glog",
115 ],
116)
117
Austin Schuh6b9c4152019-11-29 12:45:24 -0800118aos_config(
Austin Schuh39788ff2019-12-01 18:22:57 -0800119 name = "config",
120 src = "aos.json",
121 flatbuffers = [
122 ":event_loop_fbs",
Tyler Chatow67ddb032020-01-12 14:30:04 -0800123 "//aos/logging:log_message_fbs",
Austin Schuh39788ff2019-12-01 18:22:57 -0800124 ],
125)
126
127aos_config(
Austin Schuh6b9c4152019-11-29 12:45:24 -0800128 name = "pingpong_config",
Austin Schuh39788ff2019-12-01 18:22:57 -0800129 src = "pingpong.json",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800130 flatbuffers = [
131 ":ping_fbs",
132 ":pong_fbs",
133 ],
Austin Schuh39788ff2019-12-01 18:22:57 -0800134 deps = [":config"],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800135)
136
Austin Schuh15649d62019-12-28 16:36:38 -0800137aos_config(
138 name = "multinode_pingpong_config",
139 src = "multinode_pingpong.json",
140 flatbuffers = [
141 ":ping_fbs",
142 ":pong_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800143 "//aos/network:message_bridge_client_fbs",
144 "//aos/network:message_bridge_server_fbs",
Austin Schuh15649d62019-12-28 16:36:38 -0800145 ],
146 deps = [":config"],
147)
148
Austin Schuh6b9c4152019-11-29 12:45:24 -0800149cc_library(
150 name = "pong_lib",
151 srcs = [
152 "pong_lib.cc",
153 ],
154 hdrs = [
155 "pong_lib.h",
156 ],
157 deps = [
158 ":event_loop",
159 ":ping_fbs",
160 ":pong_fbs",
161 "@com_github_google_glog//:glog",
162 ],
163)
164
Alex Perrycb7da4b2019-08-28 19:35:56 -0700165cc_binary(
166 name = "pong",
167 srcs = [
168 "pong.cc",
169 ],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800170 data = ["pingpong_config.json"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700171 deps = [
Austin Schuh6b9c4152019-11-29 12:45:24 -0800172 ":ping_fbs",
173 ":pong_fbs",
174 ":pong_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700175 ":shm_event_loop",
176 "//aos:configuration",
177 "//aos:init",
178 "//aos:json_to_flatbuffer",
179 "@com_github_google_glog//:glog",
Austin Schuha1654ed2019-01-27 17:24:54 -0800180 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800181)
182
Austin Schuh6b9c4152019-11-29 12:45:24 -0800183cc_test(
184 name = "pingpong_test",
185 srcs = ["pingpong_test.cc"],
186 data = [":pingpong_config.json"],
187 deps = [
188 ":ping_lib",
189 ":pong_lib",
190 ":simulated_event_loop",
191 "//aos:configuration",
192 "//aos:flatbuffers",
193 "//aos/testing:googletest",
194 ],
195)
196
Parker Schuhe4a70d62017-12-27 20:10:20 -0800197cc_library(
Austin Schuhe4106142019-12-01 18:19:53 -0800198 name = "timing_statistics",
199 srcs = ["timing_statistics.cc"],
200 hdrs = ["timing_statistics.h"],
201 deps = [
202 ":event_loop_fbs",
203 "//aos:configuration",
204 "@com_github_google_glog//:glog",
205 ],
206)
207
208cc_test(
209 name = "timing_statistics_test",
210 srcs = ["timing_statistics_test.cc"],
211 deps = [
212 ":timing_statistics",
213 "//aos:configuration",
214 "//aos:flatbuffers",
215 "//aos/testing:googletest",
216 ],
217)
218
219cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700220 name = "shm_event_loop",
221 srcs = ["shm_event_loop.cc"],
222 hdrs = ["shm_event_loop.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800223 visibility = ["//visibility:public"],
224 deps = [
Tyler Chatow67ddb032020-01-12 14:30:04 -0800225 ":aos_logging",
Austin Schuh6b6dfa52019-06-12 20:16:20 -0700226 ":epoll",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700227 ":event_loop",
Austin Schuh39788ff2019-12-01 18:22:57 -0800228 ":event_loop_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700229 ":test_message_fbs",
Austin Schuh39788ff2019-12-01 18:22:57 -0800230 ":timing_statistics",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700231 "//aos:realtime",
232 "//aos/ipc_lib:lockless_queue",
233 "//aos/ipc_lib:signalfd",
Austin Schuh32fd5a72019-12-01 22:20:26 -0800234 "//aos/stl_mutex",
Austin Schuh52d325c2019-06-23 18:59:06 -0700235 "//aos/util:phased_loop",
Brian Silverman441591b2020-01-31 17:44:32 -0800236 "@com_google_absl//absl/base",
Austin Schuha1654ed2019-01-27 17:24:54 -0800237 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800238)
239
240cc_test(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700241 name = "shm_event_loop_test",
242 srcs = ["shm_event_loop_test.cc"],
Austin Schuh6b6dfa52019-06-12 20:16:20 -0700243 shard_count = 5,
Austin Schuha1654ed2019-01-27 17:24:54 -0800244 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700245 ":event_loop_param_test",
246 ":shm_event_loop",
247 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800248 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800249)
250
251cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700252 name = "event_loop_param_test",
Austin Schuha1654ed2019-01-27 17:24:54 -0800253 testonly = True,
Alex Perrycb7da4b2019-08-28 19:35:56 -0700254 srcs = ["event_loop_param_test.cc"],
255 hdrs = ["event_loop_param_test.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800256 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700257 ":event_loop",
258 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800259 "//aos/testing:googletest",
260 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800261)
Neil Balchc8f41ed2018-01-20 22:06:53 -0800262
263cc_test(
Austin Schuh7267c532019-05-19 19:55:53 -0700264 name = "simulated_event_loop_test",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700265 srcs = ["simulated_event_loop_test.cc"],
Austin Schuh898f4972020-01-11 17:21:25 -0800266 data = ["multinode_pingpong_config.json"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800267 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700268 ":event_loop_param_test",
Austin Schuh898f4972020-01-11 17:21:25 -0800269 ":ping_lib",
270 ":pong_lib",
Austin Schuh7267c532019-05-19 19:55:53 -0700271 ":simulated_event_loop",
Austin Schuha1654ed2019-01-27 17:24:54 -0800272 "//aos/testing:googletest",
273 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800274)
275
276cc_library(
Austin Schuhe1dafe42020-01-06 21:12:03 -0800277 name = "simple_channel",
278 srcs = ["simple_channel.cc"],
279 hdrs = ["simple_channel.h"],
280 deps = [
281 "//aos:configuration_fbs",
282 "@com_github_google_flatbuffers//:flatbuffers",
283 "@com_github_google_glog//:glog",
284 "@com_google_absl//absl/strings",
285 ],
286)
287
288cc_library(
Austin Schuh7267c532019-05-19 19:55:53 -0700289 name = "simulated_event_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700290 srcs = [
291 "event_scheduler.cc",
292 "simulated_event_loop.cc",
Austin Schuh898f4972020-01-11 17:21:25 -0800293 "simulated_network_bridge.cc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700294 ],
295 hdrs = [
296 "event_scheduler.h",
297 "simulated_event_loop.h",
Austin Schuh898f4972020-01-11 17:21:25 -0800298 "simulated_network_bridge.h",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700299 ],
Austin Schuh7267c532019-05-19 19:55:53 -0700300 visibility = ["//visibility:public"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800301 deps = [
Tyler Chatow67ddb032020-01-12 14:30:04 -0800302 ":aos_logging",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700303 ":event_loop",
Austin Schuhe1dafe42020-01-06 21:12:03 -0800304 ":simple_channel",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700305 "//aos/ipc_lib:index",
Austin Schuh52d325c2019-06-23 18:59:06 -0700306 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700307 "@com_google_absl//absl/container:btree",
Austin Schuha1654ed2019-01-27 17:24:54 -0800308 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800309)
Tyler Chatow67ddb032020-01-12 14:30:04 -0800310
311cc_library(
312 name = "aos_logging",
313 srcs = [
314 "aos_logging.cc",
315 ],
316 hdrs = [
317 "aos_logging.h",
318 ],
319 visibility = ["//visibility:public"],
320 deps = [
321 ":event_loop",
322 "//aos/logging:implementations",
323 "//aos/logging:log_message_fbs",
324 ],
325)