blob: 8142e24a6d72f6ae7e7d9868cd72e1ecbba2bdc3 [file] [log] [blame]
Austin Schuhda9d0602019-09-15 17:29:38 -07001load("@npm_bazel_typescript//:defs.bzl", "ts_library")
Philipp Schraderdada1072020-11-24 11:34:46 -08002load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "rollup_bundle")
James Kuszmaulabb77132020-08-01 19:56:16 -07003load("//aos:config.bzl", "aos_config")
Alex Perryb3b50792020-01-18 16:13:45 -08004
5filegroup(
6 name = "files",
7 srcs = glob([
8 "**/*.html",
Alex Perry5f474f22020-02-01 12:14:24 -08009 "**/*.css",
Alex Perryb3b50792020-01-18 16:13:45 -080010 ]),
Austin Schuha4f69d62020-02-28 13:58:14 -080011 visibility = ["//visibility:public"],
Alex Perryb3b50792020-01-18 16:13:45 -080012)
13
14ts_library(
15 name = "proxy",
Alex Perry5f474f22020-02-01 12:14:24 -080016 srcs = [
17 "config_handler.ts",
18 "proxy.ts",
19 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080020 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080021 visibility = ["//visibility:public"],
Alex Perryb3b50792020-01-18 16:13:45 -080022 deps = [
Alex Perryd5e13572020-02-22 15:15:08 -080023 "//aos:configuration_ts_fbs",
Austin Schuha4f69d62020-02-28 13:58:14 -080024 "//aos/network:connect_ts_fbs",
25 "//aos/network:web_proxy_ts_fbs",
Philipp Schradere625ba22020-11-16 20:11:37 -080026 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
Alex Perryb3b50792020-01-18 16:13:45 -080027 ],
Alex Perry5f474f22020-02-01 12:14:24 -080028)
29
30ts_library(
31 name = "main",
32 srcs = [
33 "main.ts",
34 "ping_handler.ts",
35 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080036 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -080037 deps = [
38 ":proxy",
39 "//aos/events:ping_ts_fbs",
40 ],
Alex Perryb3b50792020-01-18 16:13:45 -080041)
42
43rollup_bundle(
Alex Perry5f474f22020-02-01 12:14:24 -080044 name = "main_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -070045 enable_code_splitting = False,
46 entry_point = "main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -080047 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080048 visibility = ["//aos:__subpackages__"],
Alex Perryb3b50792020-01-18 16:13:45 -080049 deps = [
Austin Schuhda9d0602019-09-15 17:29:38 -070050 ":main",
Alex Perryb3b50792020-01-18 16:13:45 -080051 ],
Alex Perryb3b50792020-01-18 16:13:45 -080052)
53
54genrule(
55 name = "flatbuffers",
56 srcs = [
57 "@com_github_google_flatbuffers//:flatjs",
58 ],
59 outs = [
60 "flatbuffers.js",
61 ],
62 cmd = "cp $(location @com_github_google_flatbuffers//:flatjs) $@",
Philipp Schraderdada1072020-11-24 11:34:46 -080063 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080064 visibility = ["//aos:__subpackages__"],
Alex Perryb3b50792020-01-18 16:13:45 -080065)
James Kuszmaulabb77132020-08-01 19:56:16 -070066
67ts_library(
68 name = "reflection_test_main",
69 srcs = [
70 "reflection_test_main.ts",
71 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080072 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -070073 deps = [
74 ":reflection_ts",
Philipp Schradere625ba22020-11-16 20:11:37 -080075 "//aos:configuration_ts_fbs",
76 "//aos:json_to_flatbuffer_flatbuffer_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -070077 "//aos/network/www:proxy",
Philipp Schradere625ba22020-11-16 20:11:37 -080078 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -070079 ],
80)
81
82ts_library(
83 name = "reflection_ts",
84 srcs = ["reflection.ts"],
Philipp Schraderdada1072020-11-24 11:34:46 -080085 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -070086 visibility = ["//visibility:public"],
Philipp Schradere625ba22020-11-16 20:11:37 -080087 deps = [
88 "//aos:configuration_ts_fbs",
89 "//aos:json_to_flatbuffer_flatbuffer_ts",
90 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
91 ],
James Kuszmaulabb77132020-08-01 19:56:16 -070092)
93
James Kuszmaula8f2c452020-07-05 21:17:56 -070094ts_library(
95 name = "plotter",
96 srcs = [
97 "plotter.ts",
98 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080099 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700100 visibility = ["//visibility:public"],
101)
102
103ts_library(
104 name = "graph_main",
105 srcs = [
106 "graph_main.ts",
107 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800108 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700109 deps = [
110 ":plotter",
111 ":proxy",
112 ":reflection_ts",
Austin Schuhda9d0602019-09-15 17:29:38 -0700113 "//aos:configuration_ts_fbs",
114 "//aos/network:connect_ts_fbs",
115 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700116 ],
117)
118
119rollup_bundle(
120 name = "graph_main_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -0700121 enable_code_splitting = False,
122 entry_point = "graph_main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -0800123 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700124 deps = [
125 ":graph_main",
126 ],
127)
128
James Kuszmaulabb77132020-08-01 19:56:16 -0700129aos_config(
130 name = "test_config",
131 src = "test_config_file.json",
132 flatbuffers = [
133 "//aos:configuration_fbs",
134 "//aos:json_to_flatbuffer_flatbuffer",
135 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800136 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700137 deps = [
138 "//aos/events:config",
139 ],
140)
141
142rollup_bundle(
143 name = "reflection_test_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -0700144 enable_code_splitting = False,
145 entry_point = "reflection_test_main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -0800146 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700147 deps = [
148 ":reflection_test_main",
149 ],
150)
151
152sh_binary(
153 name = "web_proxy_demo",
154 srcs = ["web_proxy_demo.sh"],
155 data = [
James Kuszmaula8f2c452020-07-05 21:17:56 -0700156 ":graph.html",
Austin Schuhda9d0602019-09-15 17:29:38 -0700157 ":graph_main_bundle.min.js",
James Kuszmaulabb77132020-08-01 19:56:16 -0700158 ":reflection_test.html",
Austin Schuhda9d0602019-09-15 17:29:38 -0700159 ":reflection_test_bundle.min.js",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700160 ":test_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700161 "//aos/network:web_proxy_main",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700162 "//y2020:config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700163 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800164 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700165)