Lee Mracek | 3e16a86 | 2019-01-24 11:15:36 -0500 | [diff] [blame] | 1 | package(default_visibility = ["//visibility:public"]) |
| 2 | |
James Kuszmaul | 5f5e123 | 2020-12-22 20:58:00 -0800 | [diff] [blame^] | 3 | load("@npm_bazel_typescript//:defs.bzl", "ts_library") |
James Kuszmaul | 61a971f | 2020-01-01 15:06:18 -0800 | [diff] [blame] | 4 | load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") |
James Kuszmaul | 5f5e123 | 2020-12-22 20:58:00 -0800 | [diff] [blame^] | 5 | load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "rollup_bundle") |
James Kuszmaul | 61a971f | 2020-01-01 15:06:18 -0800 | [diff] [blame] | 6 | |
Lee Mracek | 3e16a86 | 2019-01-24 11:15:36 -0500 | [diff] [blame] | 7 | py_binary( |
| 8 | name = "plot_action", |
| 9 | srcs = [ |
James Kuszmaul | 41fa78a | 2019-12-14 20:53:14 -0800 | [diff] [blame] | 10 | "logentry.py", |
Austin Schuh | 8e17be9 | 2019-12-24 09:32:11 -0800 | [diff] [blame] | 11 | "logreader.py", |
| 12 | "plot_action.py", |
| 13 | "plotter.py", |
Lee Mracek | 3e16a86 | 2019-01-24 11:15:36 -0500 | [diff] [blame] | 14 | ], |
| 15 | legacy_create_init = False, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 16 | target_compatible_with = ["@platforms//os:linux"], |
Lee Mracek | 3e16a86 | 2019-01-24 11:15:36 -0500 | [diff] [blame] | 17 | deps = [ |
| 18 | ":python_init", |
James Kuszmaul | 910f92b | 2020-01-01 15:30:38 -0800 | [diff] [blame] | 19 | "@matplotlib_repo//:matplotlib2.7", |
Lee Mracek | 3e16a86 | 2019-01-24 11:15:36 -0500 | [diff] [blame] | 20 | ], |
| 21 | ) |
| 22 | |
| 23 | py_library( |
| 24 | name = "python_init", |
| 25 | srcs = ["__init__.py"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 26 | target_compatible_with = ["@platforms//os:linux"], |
Lee Mracek | 3e16a86 | 2019-01-24 11:15:36 -0500 | [diff] [blame] | 27 | deps = ["//frc971:python_init"], |
| 28 | ) |
James Kuszmaul | 7daef36 | 2019-12-31 18:28:17 -0800 | [diff] [blame] | 29 | |
| 30 | cc_binary( |
| 31 | name = "py_log_reader.so", |
| 32 | srcs = ["py_log_reader.cc"], |
| 33 | linkshared = True, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 34 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | 7daef36 | 2019-12-31 18:28:17 -0800 | [diff] [blame] | 35 | 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 | |
| 46 | py_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 Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 53 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | 7daef36 | 2019-12-31 18:28:17 -0800 | [diff] [blame] | 54 | deps = ["//aos:configuration_fbs_python"], |
| 55 | ) |
James Kuszmaul | 61a971f | 2020-01-01 15:06:18 -0800 | [diff] [blame] | 56 | |
| 57 | py_proto_library( |
| 58 | name = "plot_config_proto", |
| 59 | srcs = ["plot_config.proto"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 60 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | 61a971f | 2020-01-01 15:06:18 -0800 | [diff] [blame] | 61 | ) |
| 62 | |
| 63 | py_binary( |
| 64 | name = "plot", |
| 65 | srcs = ["plot.py"], |
| 66 | data = [ |
| 67 | ":py_log_reader.so", |
| 68 | ] + glob(["plot_configs/**"]), |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 69 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | 61a971f | 2020-01-01 15:06:18 -0800 | [diff] [blame] | 70 | deps = [ |
| 71 | ":plot_config_proto", |
| 72 | ":python_init", |
| 73 | "@matplotlib_repo//:matplotlib3", |
| 74 | ], |
| 75 | ) |
James Kuszmaul | 469fd4e | 2020-01-01 15:49:10 -0800 | [diff] [blame] | 76 | |
| 77 | py_test( |
| 78 | name = "plot_test", |
| 79 | srcs = ["plot_test.py"], |
| 80 | data = [ |
| 81 | "@sample_logfile//file", |
| 82 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 83 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | 469fd4e | 2020-01-01 15:49:10 -0800 | [diff] [blame] | 84 | deps = [":plot"], |
| 85 | ) |
James Kuszmaul | 5f5e123 | 2020-12-22 20:58:00 -0800 | [diff] [blame^] | 86 | |
| 87 | ts_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 | |
| 99 | rollup_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 | |
| 109 | filegroup( |
| 110 | name = "plotter_files", |
| 111 | srcs = [ |
| 112 | "index.html", |
| 113 | "plot_index_bundle.min.js", |
| 114 | ], |
| 115 | ) |
| 116 | |
| 117 | sh_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 | |
| 127 | sh_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 | ) |