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