1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
ash / webui / help_app_ui / resources / BUILD.gn [blame]
# Copyright 2020 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//ash/webui/help_app_ui/help_app_files.gni")
import("//ash/webui/web_applications/system_apps.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//tools/typescript/ts_library.gni")
import("//tools/typescript/webui_ts_library.gni")
import("//ui/webui/resources/tools/optimize_webui.gni")
assert(is_chromeos_ash, "Help App is ash-chrome only")
stage_folder = "$target_gen_dir/stage_rollup"
ts_root_dir = "$target_gen_dir/stage_ts"
copy("copy_for_tsc") {
visibility = [ ":build_ts" ]
public_deps = [
"//ash/webui/help_app_ui:mojo_bindings_ts__generator",
"//ash/webui/help_app_ui/search:mojo_bindings_ts__generator",
"//ash/webui/system_apps/public/js:build_ts",
"//chromeos/ash/components/local_search_service/public/mojom:mojom_ts__generator",
]
sources = [
"$root_gen_dir/ash/webui/help_app_ui/help_app_ui.mojom-webui.ts",
"$root_gen_dir/ash/webui/help_app_ui/search/search.mojom-webui.ts",
"$root_gen_dir/ash/webui/system_apps/public/js/message_pipe.js",
"$root_gen_dir/chromeos/ash/components/local_search_service/public/mojom/index.mojom-webui.ts",
"$root_gen_dir/chromeos/ash/components/local_search_service/public/mojom/types.mojom-webui.ts",
"//ui/webui/resources/js/mojo_type_util.ts",
"browser_proxy.ts",
"message_types.ts",
"receiver.ts",
]
outputs = [ "${ts_root_dir}/{{source_file_part}}" ]
}
webui_ts_library("build_ts") {
tsconfig_base = "tsconfig_base.json"
root_dir = ts_root_dir
in_files = []
foreach(o, get_target_outputs(":copy_for_tsc")) {
in_files += [ rebase_path(o, ts_root_dir) ]
}
composite = true
definitions = [ "//ash/webui/help_app_ui/resources/js/help_app.d.ts" ]
# The out_dir needs to be a different folder from the folder containing files
# generated by targets in this BUILD.gn, otherwise it may be treated as an
# artifact from a previous build which will cause ts_library to delete them.
out_dir = stage_folder
deps = [
"//ash/webui/common/resources:build_ts",
"//ash/webui/system_apps/public/js:build_ts",
"//ui/webui/resources/cr_components/color_change_listener:build_ts",
"//ui/webui/resources/mojo:build_ts",
]
extra_deps = [ ":copy_for_tsc" ]
path_mappings = [ "//system_apps/*|" + rebase_path(
"$root_gen_dir/ash/webui/system_apps/public/js/*",
target_gen_dir) ]
}
copy("stage_static") {
sources = [ "//ash/webui/system_apps/public/js/sandboxed_load_time_data.js" ]
outputs = [ stage_folder + "/{{source_file_part}}" ]
}
system_apps_dir =
rebase_path("$root_gen_dir/ash/webui/system_apps/public/js", root_build_dir)
# Generate a bundle of all the JS needed for chrome://help-app.
optimize_webui("browser_proxy_rollup") {
host = "help-app"
js_module_in_files = [ "browser_proxy.js" ]
# Exclude files that are served from chrome://resources anyway, since bundling
# them would unnecessarily increase the overall build size.
excludes = [
"chrome://resources/js/mojo_type_util.js",
"chrome://resources/mojo/mojo/public/mojom/base/string16.mojom-webui.js",
"chrome://resources/mojo/url/mojom/url.mojom-webui.js",
]
input = rebase_path(stage_folder, root_build_dir)
deps = [
":build_ts",
":stage_static",
]
external_paths = [ "//system_apps/|$system_apps_dir" ]
}
# Generate a bundle of all the JS needed for chrome-untrusted://help-app.
optimize_webui("receiver_rollup") {
host = "chrome-untrusted://help-app"
js_module_in_files = [ "receiver.js" ]
input = rebase_path(stage_folder, root_build_dir)
deps = [
":build_ts",
":stage_static",
]
external_paths = [ "//system_apps/|$system_apps_dir" ]
}
ts_library("test_build_ts") {
tsconfig_base = "tsconfig_base.json"
root_dir = ts_root_dir
testonly = true
in_files = help_app_test_ts
definitions = [
"//ash/webui/help_app_ui/resources/js/help_app.d.ts",
"//ash/webui/help_app_ui/test/test_api.d.ts",
]
deps = [
":build_ts",
"//chrome/test/data/webui:build_ts",
]
path_mappings = [ "//webui-test/*|" +
rebase_path("$root_gen_dir/chrome/test/data/webui/tsc/*",
target_gen_dir) ]
extra_deps = [ "//ash/webui/help_app_ui/test:stage_for_test_tsc" ]
}