Philipp Schrader | 87277f4 | 2022-01-01 07:45:12 -0800 | [diff] [blame] | 1 | load("@npm//@bazel/typescript:index.bzl", "ts_library") |
| 2 | load("//tools/build_rules:js.bzl", "rollup_bundle") |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 3 | load("//aos:config.bzl", "aos_config") |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 4 | |
Austin Schuh | fcd5694 | 2022-07-18 17:41:32 -0700 | [diff] [blame] | 5 | exports_files(["styles.css"]) |
| 6 | |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 7 | filegroup( |
| 8 | name = "files", |
| 9 | srcs = glob([ |
| 10 | "**/*.html", |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 11 | "**/*.css", |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 12 | ]), |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 13 | visibility = ["//visibility:public"], |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 14 | ) |
| 15 | |
| 16 | ts_library( |
| 17 | name = "proxy", |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 18 | srcs = [ |
| 19 | "config_handler.ts", |
| 20 | "proxy.ts", |
| 21 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 22 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 23 | visibility = ["//visibility:public"], |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 24 | deps = [ |
James Kuszmaul | 527038a | 2020-12-21 23:40:44 -0800 | [diff] [blame] | 25 | ":reflection_ts", |
Alex Perry | d5e1357 | 2020-02-22 15:15:08 -0800 | [diff] [blame] | 26 | "//aos:configuration_ts_fbs", |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 27 | "//aos/network:connect_ts_fbs", |
| 28 | "//aos/network:web_proxy_ts_fbs", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 29 | "@com_github_google_flatbuffers//reflection:reflection_ts_fbs", |
Philipp Schrader | e625ba2 | 2020-11-16 20:11:37 -0800 | [diff] [blame] | 30 | "@com_github_google_flatbuffers//ts:flatbuffers_ts", |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 31 | ], |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 32 | ) |
| 33 | |
| 34 | ts_library( |
| 35 | name = "main", |
| 36 | srcs = [ |
| 37 | "main.ts", |
| 38 | "ping_handler.ts", |
| 39 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 40 | target_compatible_with = ["@platforms//os:linux"], |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 41 | deps = [ |
| 42 | ":proxy", |
| 43 | "//aos/events:ping_ts_fbs", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 44 | "@com_github_google_flatbuffers//ts:flatbuffers_ts", |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 45 | ], |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 46 | ) |
| 47 | |
| 48 | rollup_bundle( |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 49 | name = "main_bundle", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 50 | entry_point = "main.ts", |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 51 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 52 | visibility = ["//aos:__subpackages__"], |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 53 | deps = [ |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 54 | ":main", |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 55 | ], |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 56 | ) |
| 57 | |
| 58 | genrule( |
| 59 | name = "flatbuffers", |
| 60 | srcs = [ |
| 61 | "@com_github_google_flatbuffers//:flatjs", |
| 62 | ], |
| 63 | outs = [ |
| 64 | "flatbuffers.js", |
| 65 | ], |
| 66 | cmd = "cp $(location @com_github_google_flatbuffers//:flatjs) $@", |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 67 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 68 | visibility = ["//aos:__subpackages__"], |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 69 | ) |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 70 | |
| 71 | ts_library( |
| 72 | name = "reflection_test_main", |
| 73 | srcs = [ |
| 74 | "reflection_test_main.ts", |
| 75 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 76 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 77 | deps = [ |
| 78 | ":reflection_ts", |
Philipp Schrader | e625ba2 | 2020-11-16 20:11:37 -0800 | [diff] [blame] | 79 | "//aos:configuration_ts_fbs", |
Brian Silverman | c5105ab | 2021-02-10 17:55:38 -0800 | [diff] [blame] | 80 | "//aos:json_to_flatbuffer_fbs_ts", |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 81 | "//aos/network/www:proxy", |
Philipp Schrader | e625ba2 | 2020-11-16 20:11:37 -0800 | [diff] [blame] | 82 | "@com_github_google_flatbuffers//ts:flatbuffers_ts", |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 83 | ], |
| 84 | ) |
| 85 | |
| 86 | ts_library( |
| 87 | name = "reflection_ts", |
| 88 | srcs = ["reflection.ts"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 89 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | a8f2c45 | 2020-07-05 21:17:56 -0700 | [diff] [blame] | 90 | visibility = ["//visibility:public"], |
Philipp Schrader | e625ba2 | 2020-11-16 20:11:37 -0800 | [diff] [blame] | 91 | deps = [ |
| 92 | "//aos:configuration_ts_fbs", |
Brian Silverman | c5105ab | 2021-02-10 17:55:38 -0800 | [diff] [blame] | 93 | "//aos:json_to_flatbuffer_fbs_ts", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 94 | "@com_github_google_flatbuffers//reflection:reflection_ts_fbs", |
Philipp Schrader | e625ba2 | 2020-11-16 20:11:37 -0800 | [diff] [blame] | 95 | "@com_github_google_flatbuffers//ts:flatbuffers_ts", |
| 96 | ], |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 97 | ) |
| 98 | |
James Kuszmaul | a8f2c45 | 2020-07-05 21:17:56 -0700 | [diff] [blame] | 99 | ts_library( |
James Kuszmaul | 933a974 | 2021-03-07 19:59:06 -0800 | [diff] [blame] | 100 | name = "colors", |
| 101 | srcs = [ |
| 102 | "colors.ts", |
| 103 | ], |
| 104 | target_compatible_with = ["@platforms//os:linux"], |
| 105 | visibility = ["//visibility:public"], |
| 106 | ) |
| 107 | |
| 108 | ts_library( |
James Kuszmaul | a8f2c45 | 2020-07-05 21:17:56 -0700 | [diff] [blame] | 109 | name = "plotter", |
| 110 | srcs = [ |
| 111 | "plotter.ts", |
| 112 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 113 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | a8f2c45 | 2020-07-05 21:17:56 -0700 | [diff] [blame] | 114 | visibility = ["//visibility:public"], |
James Kuszmaul | 933a974 | 2021-03-07 19:59:06 -0800 | [diff] [blame] | 115 | deps = [":colors"], |
James Kuszmaul | a8f2c45 | 2020-07-05 21:17:56 -0700 | [diff] [blame] | 116 | ) |
| 117 | |
| 118 | ts_library( |
James Kuszmaul | 5f5e123 | 2020-12-22 20:58:00 -0800 | [diff] [blame] | 119 | name = "aos_plotter", |
James Kuszmaul | a8f2c45 | 2020-07-05 21:17:56 -0700 | [diff] [blame] | 120 | srcs = [ |
James Kuszmaul | 5f5e123 | 2020-12-22 20:58:00 -0800 | [diff] [blame] | 121 | "aos_plotter.ts", |
James Kuszmaul | a8f2c45 | 2020-07-05 21:17:56 -0700 | [diff] [blame] | 122 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 123 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | 5f5e123 | 2020-12-22 20:58:00 -0800 | [diff] [blame] | 124 | visibility = ["//visibility:public"], |
James Kuszmaul | a8f2c45 | 2020-07-05 21:17:56 -0700 | [diff] [blame] | 125 | deps = [ |
| 126 | ":plotter", |
| 127 | ":proxy", |
| 128 | ":reflection_ts", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 129 | "//aos:configuration_ts_fbs", |
| 130 | "//aos/network:connect_ts_fbs", |
James Kuszmaul | 71a8193 | 2020-12-15 21:08:01 -0800 | [diff] [blame] | 131 | "//aos/network:web_proxy_ts_fbs", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 132 | "@com_github_google_flatbuffers//reflection:reflection_ts_fbs", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 133 | "@com_github_google_flatbuffers//ts:flatbuffers_ts", |
James Kuszmaul | a8f2c45 | 2020-07-05 21:17:56 -0700 | [diff] [blame] | 134 | ], |
| 135 | ) |
| 136 | |
James Kuszmaul | 5f5e123 | 2020-12-22 20:58:00 -0800 | [diff] [blame] | 137 | ts_library( |
| 138 | name = "demo_plot", |
| 139 | srcs = [ |
| 140 | "demo_plot.ts", |
| 141 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 142 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | 5f5e123 | 2020-12-22 20:58:00 -0800 | [diff] [blame] | 143 | visibility = ["//visibility:public"], |
James Kuszmaul | a8f2c45 | 2020-07-05 21:17:56 -0700 | [diff] [blame] | 144 | deps = [ |
James Kuszmaul | 5f5e123 | 2020-12-22 20:58:00 -0800 | [diff] [blame] | 145 | ":aos_plotter", |
| 146 | ":plotter", |
| 147 | ":proxy", |
| 148 | ":reflection_ts", |
| 149 | "//aos:configuration_ts_fbs", |
| 150 | "//aos/network:connect_ts_fbs", |
| 151 | "//aos/network:web_proxy_ts_fbs", |
| 152 | "//frc971/wpilib:imu_batch_ts_fbs", |
| 153 | "@com_github_google_flatbuffers//ts:flatbuffers_ts", |
James Kuszmaul | a8f2c45 | 2020-07-05 21:17:56 -0700 | [diff] [blame] | 154 | ], |
| 155 | ) |
| 156 | |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 157 | aos_config( |
| 158 | name = "test_config", |
| 159 | src = "test_config_file.json", |
| 160 | flatbuffers = [ |
| 161 | "//aos:configuration_fbs", |
Brian Silverman | c5105ab | 2021-02-10 17:55:38 -0800 | [diff] [blame] | 162 | "//aos:json_to_flatbuffer_fbs", |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 163 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 164 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | 5f5e123 | 2020-12-22 20:58:00 -0800 | [diff] [blame] | 165 | visibility = ["//visibility:public"], |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 166 | deps = [ |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 167 | "//aos/events:aos_config", |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 168 | ], |
| 169 | ) |
| 170 | |
| 171 | rollup_bundle( |
| 172 | name = "reflection_test_bundle", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 173 | entry_point = "reflection_test_main.ts", |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 174 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 175 | deps = [ |
| 176 | ":reflection_test_main", |
| 177 | ], |
| 178 | ) |
| 179 | |
| 180 | sh_binary( |
| 181 | name = "web_proxy_demo", |
| 182 | srcs = ["web_proxy_demo.sh"], |
| 183 | data = [ |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 184 | ":reflection_test.html", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 185 | ":reflection_test_bundle.min.js", |
Austin Schuh | 14d7d3d | 2020-09-10 18:14:36 -0700 | [diff] [blame] | 186 | ":test_config", |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 187 | "//aos/network:web_proxy_main", |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 188 | "//y2020:aos_config", |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 189 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 190 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 191 | ) |