Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 1 | load("@aspect_bazel_lib//lib:copy_file.bzl", "copy_file") |
Emily Markova | 7b78640 | 2024-01-24 20:05:24 -0800 | [diff] [blame^] | 2 | load("@aspect_rules_js//js:defs.bzl", "js_binary", "js_run_binary") |
| 3 | load("@npm//:@angular/service-worker/package_json.bzl", angular_service_worker = "bin") |
Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 4 | load("@npm//:defs.bzl", "npm_link_all_packages") |
| 5 | load("//tools/build_rules:js.bzl", "ng_application") |
Emily Markova | 7b78640 | 2024-01-24 20:05:24 -0800 | [diff] [blame^] | 6 | load(":defs.bzl", "assemble_service_worker_files", "assemble_static_files") |
Alex Perry | b316808 | 2022-01-22 13:36:13 -0800 | [diff] [blame] | 7 | |
Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 8 | npm_link_all_packages(name = "node_modules") |
| 9 | |
Emily Markova | 7b78640 | 2024-01-24 20:05:24 -0800 | [diff] [blame^] | 10 | assemble_service_worker_files( |
| 11 | name = "service_worker_files", |
| 12 | outs = [ |
| 13 | "ngsw-worker.js", |
| 14 | ], |
| 15 | ) |
| 16 | |
Philipp Schrader | e2e27ff | 2024-02-25 22:08:55 -0800 | [diff] [blame] | 17 | OPENCV_VERSION = "4.9.0" |
| 18 | |
| 19 | copy_file( |
| 20 | name = "opencv.js", |
| 21 | src = "@opencv_wasm//file", |
| 22 | out = "assets/opencv_{}/opencv.js".format(OPENCV_VERSION), |
| 23 | ) |
| 24 | |
Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 25 | ng_application( |
Alex Perry | b316808 | 2022-01-22 13:36:13 -0800 | [diff] [blame] | 26 | name = "app", |
Philipp Schrader | e2e27ff | 2024-02-25 22:08:55 -0800 | [diff] [blame] | 27 | assets = [ |
Emily Markova | 7b78640 | 2024-01-24 20:05:24 -0800 | [diff] [blame^] | 28 | "manifest.json", |
Philipp Schrader | e2e27ff | 2024-02-25 22:08:55 -0800 | [diff] [blame] | 29 | ":opencv.js", |
| 30 | ], |
Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 31 | extra_srcs = [ |
| 32 | "app/common.css", |
| 33 | ], |
| 34 | html_assets = [ |
| 35 | "favicon.ico", |
Emily Markova | 7b78640 | 2024-01-24 20:05:24 -0800 | [diff] [blame^] | 36 | "assets/971_144.png", |
Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 37 | ], |
Alex Perry | b316808 | 2022-01-22 13:36:13 -0800 | [diff] [blame] | 38 | deps = [ |
Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 39 | "//:node_modules/@angular/animations", |
Emily Markova | 7b78640 | 2024-01-24 20:05:24 -0800 | [diff] [blame^] | 40 | "//:node_modules/@angular/service-worker", |
Philipp Schrader | 89342e5 | 2023-03-03 20:47:21 -0800 | [diff] [blame] | 41 | "//scouting/www/driver_ranking", |
| 42 | "//scouting/www/entry", |
| 43 | "//scouting/www/match_list", |
| 44 | "//scouting/www/notes", |
Emily Markova | faecfe1 | 2023-07-01 12:40:03 -0700 | [diff] [blame] | 45 | "//scouting/www/pit_scouting", |
Philipp Schrader | e2e27ff | 2024-02-25 22:08:55 -0800 | [diff] [blame] | 46 | "//scouting/www/scan", |
Philipp Schrader | 89342e5 | 2023-03-03 20:47:21 -0800 | [diff] [blame] | 47 | "//scouting/www/shift_schedule", |
| 48 | "//scouting/www/view", |
Alex Perry | b316808 | 2022-01-22 13:36:13 -0800 | [diff] [blame] | 49 | ], |
| 50 | ) |
| 51 | |
Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 52 | assemble_static_files( |
Philipp Schrader | 577befe | 2022-03-15 00:00:49 -0700 | [diff] [blame] | 53 | name = "static_files", |
Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 54 | app_files = ":app", |
| 55 | pictures = [ |
Emily Markova | dcadcb6 | 2024-02-03 13:07:17 -0800 | [diff] [blame] | 56 | "//third_party/y2024/field:pictures", |
Emily Markova | 7b78640 | 2024-01-24 20:05:24 -0800 | [diff] [blame^] | 57 | ":ngsw-worker.js", |
| 58 | ":ngsw.json", |
Philipp Schrader | 577befe | 2022-03-15 00:00:49 -0700 | [diff] [blame] | 59 | ], |
Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 60 | replace_prefixes = { |
| 61 | "prod": "", |
| 62 | "dev": "", |
Emily Markova | dcadcb6 | 2024-02-03 13:07:17 -0800 | [diff] [blame] | 63 | "third_party/y2024": "pictures", |
Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 64 | }, |
Austin Schuh | f737d47 | 2023-07-29 17:35:59 -0700 | [diff] [blame] | 65 | tags = [ |
| 66 | "no-remote-cache", |
| 67 | ], |
Philipp Schrader | 684a8e8 | 2022-02-25 17:39:28 -0800 | [diff] [blame] | 68 | visibility = ["//visibility:public"], |
Alex Perry | b316808 | 2022-01-22 13:36:13 -0800 | [diff] [blame] | 69 | ) |
| 70 | |
Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 71 | copy_file( |
| 72 | name = "app_common_css", |
| 73 | src = "common.css", |
| 74 | out = "app/common.css", |
Philipp Schrader | 72beced | 2022-03-07 05:29:52 -0800 | [diff] [blame] | 75 | visibility = ["//scouting/www:__subpackages__"], |
| 76 | ) |
Emily Markova | 7b78640 | 2024-01-24 20:05:24 -0800 | [diff] [blame^] | 77 | |
| 78 | angular_service_worker.ngsw_config_binary( |
| 79 | name = "ngsw_config_binary", |
| 80 | ) |
| 81 | |
| 82 | js_binary( |
| 83 | name = "ngsw_config_wrapper", |
| 84 | data = [ |
| 85 | ":ngsw_config_binary", |
| 86 | ], |
| 87 | entry_point = "ngsw_config_wrapper.js", |
| 88 | ) |
| 89 | |
| 90 | js_run_binary( |
| 91 | name = "ngsw_config", |
| 92 | srcs = [ |
| 93 | "manifest.json", |
| 94 | "ngsw-config.json", |
| 95 | ":app", |
| 96 | ":ngsw_config_binary", |
| 97 | ], |
| 98 | outs = [ |
| 99 | "ngsw.json", |
| 100 | ], |
| 101 | args = [ |
| 102 | "$(rootpath :ngsw_config_binary)", |
| 103 | "$(rootpath :ngsw.json)", |
| 104 | "$(rootpath :prod)", |
| 105 | "$(rootpath ngsw-config.json)", |
| 106 | ], |
| 107 | tool = ":ngsw_config_wrapper", |
| 108 | ) |