forked from ChromeDevTools/devtools-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbundle.gni
More file actions
92 lines (78 loc) · 2.83 KB
/
bundle.gni
File metadata and controls
92 lines (78 loc) · 2.83 KB
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
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("../../../third_party/typescript/typescript.gni")
import("./node.gni")
import("./vars.gni")
declare_args() {
# If this is enabled, devtools build uses esbuild instead of rollup.js to
# bundle JavaScript files.
devtools_fast_bundle = devtools_skip_typecheck
}
assert(!(devtools_fast_bundle && is_official_build),
"Official build should not bundle with esbuild")
template("bundle") {
assert(defined(invoker.entrypoint),
"You must define the 'entrypoint' for a bundle target")
if (devtools_fast_bundle) {
node_action(target_name) {
script = "scripts/build/esbuild.js"
forward_variables_from(invoker,
[
"visibility",
"deps",
"public_deps",
])
inputs = [
invoker.entrypoint,
devtools_location_prepend + "scripts/build/devtools_plugin.js",
devtools_location_prepend + "scripts/devtools_paths.js",
]
_esbuild = devtools_location_prepend + "third_party/esbuild/esbuild"
if (host_os == "win") {
inputs += [ _esbuild + ".exe" ]
} else {
inputs += [ _esbuild ]
}
args = [
rebase_path(invoker.entrypoint, root_build_dir),
rebase_path(invoker.output_file_location, root_build_dir),
]
outputs = [ invoker.output_file_location ]
}
} else {
node_action(target_name) {
script = "node_modules/rollup/dist/bin/rollup"
forward_variables_from(invoker,
[
"visibility",
"deps",
"public_deps",
])
inputs = [
invoker.entrypoint,
devtools_location_prepend + "scripts/build/rollup.config.js",
devtools_location_prepend + "scripts/build/devtools_plugin.js",
devtools_location_prepend + "scripts/devtools_paths.js",
]
args = [
# TODO(crbug.com/1098074): We need to hide warnings that are written stderr,
# as Chromium does not process the returncode of the subprocess correctly
# and instead looks if `stderr` is empty.
"--silent",
"--config",
rebase_path(
devtools_location_prepend + "scripts/build/rollup.config.js",
root_build_dir),
"--input",
rebase_path(invoker.entrypoint, root_build_dir),
"--file",
rebase_path(invoker.output_file_location, root_build_dir),
]
if (!devtools_dcheck_always_on) {
args += [ "--configDCHECK" ]
}
outputs = [ invoker.output_file_location ]
}
}
}