Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 1 | load("@npm_bazel_typescript//:defs.bzl", "ts_library") |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 2 | load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle", "nodejs_binary") |
| 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 | ], |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 20 | visibility = ["//visibility:public"], |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 21 | deps = [ |
Alex Perry | d5e1357 | 2020-02-22 15:15:08 -0800 | [diff] [blame] | 22 | "//aos:configuration_ts_fbs", |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 23 | "//aos/network:connect_ts_fbs", |
| 24 | "//aos/network:web_proxy_ts_fbs", |
Philipp Schrader | e625ba2 | 2020-11-16 20:11:37 -0800 | [diff] [blame] | 25 | "@com_github_google_flatbuffers//ts:flatbuffers_ts", |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 26 | ], |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 27 | ) |
| 28 | |
| 29 | ts_library( |
| 30 | name = "main", |
| 31 | srcs = [ |
| 32 | "main.ts", |
| 33 | "ping_handler.ts", |
| 34 | ], |
| 35 | deps = [ |
| 36 | ":proxy", |
| 37 | "//aos/events:ping_ts_fbs", |
| 38 | ], |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 39 | ) |
| 40 | |
| 41 | rollup_bundle( |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 42 | name = "main_bundle", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 43 | enable_code_splitting = False, |
| 44 | entry_point = "main.ts", |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 45 | visibility = ["//aos:__subpackages__"], |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 46 | deps = [ |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 47 | ":main", |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 48 | ], |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 49 | ) |
| 50 | |
| 51 | genrule( |
| 52 | name = "flatbuffers", |
| 53 | srcs = [ |
| 54 | "@com_github_google_flatbuffers//:flatjs", |
| 55 | ], |
| 56 | outs = [ |
| 57 | "flatbuffers.js", |
| 58 | ], |
| 59 | cmd = "cp $(location @com_github_google_flatbuffers//:flatjs) $@", |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 60 | visibility = ["//aos:__subpackages__"], |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 61 | ) |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 62 | |
| 63 | ts_library( |
| 64 | name = "reflection_test_main", |
| 65 | srcs = [ |
| 66 | "reflection_test_main.ts", |
| 67 | ], |
| 68 | deps = [ |
| 69 | ":reflection_ts", |
Philipp Schrader | e625ba2 | 2020-11-16 20:11:37 -0800 | [diff] [blame] | 70 | "//aos:configuration_ts_fbs", |
| 71 | "//aos:json_to_flatbuffer_flatbuffer_ts", |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 72 | "//aos/network/www:proxy", |
Philipp Schrader | e625ba2 | 2020-11-16 20:11:37 -0800 | [diff] [blame] | 73 | "@com_github_google_flatbuffers//ts:flatbuffers_ts", |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 74 | ], |
| 75 | ) |
| 76 | |
| 77 | ts_library( |
| 78 | name = "reflection_ts", |
| 79 | srcs = ["reflection.ts"], |
James Kuszmaul | a8f2c45 | 2020-07-05 21:17:56 -0700 | [diff] [blame] | 80 | visibility = ["//visibility:public"], |
Philipp Schrader | e625ba2 | 2020-11-16 20:11:37 -0800 | [diff] [blame] | 81 | deps = [ |
| 82 | "//aos:configuration_ts_fbs", |
| 83 | "//aos:json_to_flatbuffer_flatbuffer_ts", |
| 84 | "@com_github_google_flatbuffers//ts:flatbuffers_ts", |
| 85 | ], |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 86 | ) |
| 87 | |
James Kuszmaul | a8f2c45 | 2020-07-05 21:17:56 -0700 | [diff] [blame] | 88 | ts_library( |
| 89 | name = "plotter", |
| 90 | srcs = [ |
| 91 | "plotter.ts", |
| 92 | ], |
| 93 | visibility = ["//visibility:public"], |
| 94 | ) |
| 95 | |
| 96 | ts_library( |
| 97 | name = "graph_main", |
| 98 | srcs = [ |
| 99 | "graph_main.ts", |
| 100 | ], |
| 101 | deps = [ |
| 102 | ":plotter", |
| 103 | ":proxy", |
| 104 | ":reflection_ts", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 105 | "//aos:configuration_ts_fbs", |
| 106 | "//aos/network:connect_ts_fbs", |
| 107 | "@com_github_google_flatbuffers//ts:flatbuffers_ts", |
James Kuszmaul | a8f2c45 | 2020-07-05 21:17:56 -0700 | [diff] [blame] | 108 | ], |
| 109 | ) |
| 110 | |
| 111 | rollup_bundle( |
| 112 | name = "graph_main_bundle", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 113 | enable_code_splitting = False, |
| 114 | entry_point = "graph_main.ts", |
James Kuszmaul | a8f2c45 | 2020-07-05 21:17:56 -0700 | [diff] [blame] | 115 | deps = [ |
| 116 | ":graph_main", |
| 117 | ], |
| 118 | ) |
| 119 | |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 120 | aos_config( |
| 121 | name = "test_config", |
| 122 | src = "test_config_file.json", |
| 123 | flatbuffers = [ |
| 124 | "//aos:configuration_fbs", |
| 125 | "//aos:json_to_flatbuffer_flatbuffer", |
| 126 | ], |
| 127 | deps = [ |
| 128 | "//aos/events:config", |
| 129 | ], |
| 130 | ) |
| 131 | |
| 132 | rollup_bundle( |
| 133 | name = "reflection_test_bundle", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 134 | enable_code_splitting = False, |
| 135 | entry_point = "reflection_test_main.ts", |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 136 | deps = [ |
| 137 | ":reflection_test_main", |
| 138 | ], |
| 139 | ) |
| 140 | |
| 141 | sh_binary( |
| 142 | name = "web_proxy_demo", |
| 143 | srcs = ["web_proxy_demo.sh"], |
| 144 | data = [ |
James Kuszmaul | a8f2c45 | 2020-07-05 21:17:56 -0700 | [diff] [blame] | 145 | ":graph.html", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 146 | ":graph_main_bundle.min.js", |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 147 | ":reflection_test.html", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 148 | ":reflection_test_bundle.min.js", |
Austin Schuh | 14d7d3d | 2020-09-10 18:14:36 -0700 | [diff] [blame] | 149 | ":test_config", |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 150 | "//aos/network:web_proxy_main", |
Austin Schuh | 14d7d3d | 2020-09-10 18:14:36 -0700 | [diff] [blame] | 151 | "//y2020:config", |
James Kuszmaul | abb7713 | 2020-08-01 19:56:16 -0700 | [diff] [blame] | 152 | ], |
| 153 | ) |