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