blob: 465df0da5960e8845c4b9557fb0d5d5f132c9ff9 [file] [log] [blame]
Lee Mracek3e16a862019-01-24 11:15:36 -05001package(default_visibility = ["//visibility:public"])
2
James Kuszmaul5f5e1232020-12-22 20:58:00 -08003load("@npm_bazel_typescript//:defs.bzl", "ts_library")
James Kuszmaul61a971f2020-01-01 15:06:18 -08004load("@com_google_protobuf//:protobuf.bzl", "py_proto_library")
James Kuszmaul5f5e1232020-12-22 20:58:00 -08005load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "rollup_bundle")
James Kuszmaul61a971f2020-01-01 15:06:18 -08006
Lee Mracek3e16a862019-01-24 11:15:36 -05007py_binary(
8 name = "plot_action",
9 srcs = [
James Kuszmaul41fa78a2019-12-14 20:53:14 -080010 "logentry.py",
Austin Schuh8e17be92019-12-24 09:32:11 -080011 "logreader.py",
12 "plot_action.py",
13 "plotter.py",
Lee Mracek3e16a862019-01-24 11:15:36 -050014 ],
15 legacy_create_init = False,
Philipp Schraderdada1072020-11-24 11:34:46 -080016 target_compatible_with = ["@platforms//os:linux"],
Lee Mracek3e16a862019-01-24 11:15:36 -050017 deps = [
18 ":python_init",
James Kuszmaul910f92b2020-01-01 15:30:38 -080019 "@matplotlib_repo//:matplotlib2.7",
Lee Mracek3e16a862019-01-24 11:15:36 -050020 ],
21)
22
23py_library(
24 name = "python_init",
25 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -080026 target_compatible_with = ["@platforms//os:linux"],
Lee Mracek3e16a862019-01-24 11:15:36 -050027 deps = ["//frc971:python_init"],
28)
James Kuszmaul7daef362019-12-31 18:28:17 -080029
30cc_binary(
31 name = "py_log_reader.so",
32 srcs = ["py_log_reader.cc"],
33 linkshared = True,
Philipp Schraderdada1072020-11-24 11:34:46 -080034 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul7daef362019-12-31 18:28:17 -080035 deps = [
36 "//aos:configuration",
37 "//aos:json_to_flatbuffer",
38 "//aos/events:shm_event_loop",
39 "//aos/events:simulated_event_loop",
40 "//aos/events/logging:logger",
41 "@com_github_google_glog//:glog",
42 "@python_repo//:python3.5_lib",
43 ],
44)
45
46py_test(
47 name = "log_reader_test",
48 srcs = ["log_reader_test.py"],
49 data = [
50 ":py_log_reader.so",
51 "@sample_logfile//file",
52 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080053 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul7daef362019-12-31 18:28:17 -080054 deps = ["//aos:configuration_fbs_python"],
55)
James Kuszmaul61a971f2020-01-01 15:06:18 -080056
57py_proto_library(
58 name = "plot_config_proto",
59 srcs = ["plot_config.proto"],
Philipp Schraderdada1072020-11-24 11:34:46 -080060 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul61a971f2020-01-01 15:06:18 -080061)
62
63py_binary(
64 name = "plot",
65 srcs = ["plot.py"],
66 data = [
67 ":py_log_reader.so",
68 ] + glob(["plot_configs/**"]),
Philipp Schraderdada1072020-11-24 11:34:46 -080069 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul61a971f2020-01-01 15:06:18 -080070 deps = [
71 ":plot_config_proto",
72 ":python_init",
73 "@matplotlib_repo//:matplotlib3",
74 ],
75)
James Kuszmaul469fd4e2020-01-01 15:49:10 -080076
77py_test(
78 name = "plot_test",
79 srcs = ["plot_test.py"],
80 data = [
81 "@sample_logfile//file",
82 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080083 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul469fd4e2020-01-01 15:49:10 -080084 deps = [":plot"],
85)
James Kuszmaul5f5e1232020-12-22 20:58:00 -080086
87ts_library(
88 name = "plot_index",
89 srcs = ["plot_index.ts"],
90 target_compatible_with = ["@platforms//os:linux"],
91 deps = [
92 "//aos:configuration_ts_fbs",
93 "//aos/network/www:demo_plot",
94 "//aos/network/www:proxy",
95 "//frc971/wpilib:imu_plotter",
96 ],
97)
98
99rollup_bundle(
100 name = "plot_index_bundle",
101 enable_code_splitting = False,
102 entry_point = "plot_index.ts",
103 target_compatible_with = ["@platforms//os:linux"],
104 deps = [
105 ":plot_index",
106 ],
107)
108
109filegroup(
110 name = "plotter_files",
111 srcs = [
112 "index.html",
113 "plot_index_bundle.min.js",
114 ],
115)
116
117sh_binary(
118 name = "web_plotter",
119 srcs = ["web_plotter.sh"],
120 data = [
121 ":plotter_files",
122 "//aos/network:log_web_proxy_main",
123 ],
124 target_compatible_with = ["@platforms//os:linux"],
125)
126
127sh_binary(
128 name = "live_web_plotter_demo",
129 srcs = ["live_web_plotter_demo.sh"],
130 data = [
131 ":plotter_files",
132 "//aos/network:web_proxy_main",
133 "//aos/network/www:test_config",
134 ],
135 target_compatible_with = ["@platforms//os:linux"],
136)