Move generic packages from frc971/analysis to aos
To eliminate a dependency of aos on frc971.
Signed-off-by: Stephan Pleines <pleines.stephan@gmail.com>
Change-Id: Ic4a8f75da29f8e8c6675d96f02824cd08a9b99be
diff --git a/aos/analysis/cpp_plot/BUILD b/aos/analysis/cpp_plot/BUILD
new file mode 100644
index 0000000..7286aaf
--- /dev/null
+++ b/aos/analysis/cpp_plot/BUILD
@@ -0,0 +1,42 @@
+load("//tools/build_rules:js.bzl", "rollup_bundle", "ts_project")
+
+package(default_visibility = ["//visibility:public"])
+
+ts_project(
+ name = "cpp_plot",
+ srcs = ["cpp_plot.ts"],
+ target_compatible_with = ["@platforms//os:linux"],
+ deps = [
+ "//aos:configuration_ts_fbs",
+ "//aos/analysis:plot_data_utils",
+ "//aos/network/www:proxy",
+ ],
+)
+
+rollup_bundle(
+ name = "cpp_plot_bundle",
+ entry_point = "cpp_plot.ts",
+ target_compatible_with = ["@platforms//os:linux"],
+ deps = [
+ ":cpp_plot",
+ ],
+)
+
+genrule(
+ name = "copy_css",
+ srcs = [
+ "//aos/network/www:styles.css",
+ ],
+ outs = ["styles.css"],
+ cmd = "cp $< $@",
+)
+
+filegroup(
+ name = "cpp_plot_files",
+ srcs = [
+ "cpp_plot_bundle.js",
+ "cpp_plot_bundle.min.js",
+ "index.html",
+ "styles.css",
+ ],
+)
diff --git a/aos/analysis/cpp_plot/cpp_plot.ts b/aos/analysis/cpp_plot/cpp_plot.ts
new file mode 100644
index 0000000..08e2b1c
--- /dev/null
+++ b/aos/analysis/cpp_plot/cpp_plot.ts
@@ -0,0 +1,15 @@
+// Plotter for the C++ in-process plotter.
+import {Configuration} from '../../../aos/configuration_generated';
+import {Connection} from '../../../aos/network/www/proxy';
+import {plotData} from '../plot_data_utils';
+
+const rootDiv = document.createElement('div');
+rootDiv.classList.add('aos_cpp_plot');
+document.body.appendChild(rootDiv);
+
+const conn = new Connection();
+conn.connect();
+
+conn.addConfigHandler((config: Configuration) => {
+ plotData(conn, rootDiv);
+});
diff --git a/aos/analysis/cpp_plot/index.html b/aos/analysis/cpp_plot/index.html
new file mode 100644
index 0000000..fbb5199
--- /dev/null
+++ b/aos/analysis/cpp_plot/index.html
@@ -0,0 +1,9 @@
+<html>
+ <head>
+ <script src="cpp_plot_bundle.min.js" defer></script>
+ <link rel="stylesheet" href="styles.css">
+ </head>
+ <body>
+ </body>
+</html>
+