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