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