Skip to content

Commit eb7e352

Browse files
szuendDevtools-frontend LUCI CQ
authored andcommitted
[build] Add 'copy_to_gen_with_grd' GN template
This CL adds a new GN template that works similar to 'copy_to_gen' but also marks the file as included in the release GRD bundle. This makes it also similar to the 'devtools_pre_built' but not restricted to JS files. Drive-by: Split the CSS color tokens off the web test runner. We are looking into excluding the integration_test_runner.html from the release GRD and having the CSS color tokens woven together with the web test runner in the BUILD.gn prevents that. [email protected] Bug: 382387670 Change-Id: Ie1399aa07e44b418fe295eb29b1d5f609934d48f Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6450344 Reviewed-by: Benedikt Meurer <[email protected]> Commit-Queue: Simon Zünd <[email protected]>
1 parent 6450247 commit eb7e352

File tree

4 files changed

+33
-35
lines changed

4 files changed

+33
-35
lines changed

front_end/BUILD.gn

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import("../scripts/build/typescript/typescript.gni")
1010

1111
group("front_end") {
1212
public_deps = [
13+
":color_tokens",
1314
":devtools_json",
1415
":embedder-scripts",
1516
":html_entrypoints",
@@ -34,20 +35,15 @@ group("front_end") {
3435
]
3536
}
3637

37-
copy_to_gen("integration_test_runner-gen") {
38+
copy_to_gen_with_grd("color_tokens") {
3839
sources = [
3940
"application_tokens.css",
4041
"design_system_tokens.css",
41-
"integration_test_runner.html",
4242
]
4343
}
4444

45-
group("integration_test_runner") {
46-
public_deps = [ ":integration_test_runner-gen" ]
47-
data_deps = public_deps
48-
metadata = {
49-
grd_files = get_target_outputs(":integration_test_runner-gen")
50-
}
45+
copy_to_gen_with_grd("integration_test_runner") {
46+
sources = [ "integration_test_runner.html" ]
5147
}
5248

5349
node_action("devtools_json") {
@@ -99,21 +95,13 @@ node_action("html_entrypoints") {
9995
}
10096
}
10197

102-
copy_to_gen("embedder-scripts-gen") {
98+
copy_to_gen_with_grd("embedder-scripts") {
10399
sources = [
104100
"Tests.js",
105101
"devtools_compatibility.js",
106102
]
107103
}
108104

109-
group("embedder-scripts") {
110-
public_deps = [ ":embedder-scripts-gen" ]
111-
data_deps = public_deps
112-
metadata = {
113-
grd_files = get_target_outputs(":embedder-scripts-gen")
114-
}
115-
}
116-
117105
group("unittests") {
118106
deps = [
119107
"Images:optimize_images",

front_end/emulated_devices/optimized/BUILD.gn

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44
import("../../../scripts/build/ninja/copy.gni")
55
import("./optimized_images.gni")
66

7-
copy_to_gen("optimized_emulated_devices-gen") {
7+
copy_to_gen_with_grd("optimized_emulated_devices") {
88
sources = devtools_emulated_devices_images
99
}
10-
11-
group("optimized_emulated_devices") {
12-
public_deps = [ ":optimized_emulated_devices-gen" ]
13-
data_deps = public_deps
14-
metadata = {
15-
grd_files = get_target_outputs(":optimized_emulated_devices-gen")
16-
}
17-
}

front_end/panels/whats_new/resources/BUILD.gn

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44

55
import("../../../../scripts/build/ninja/copy.gni")
66

7-
copy_to_gen("resources-gen") {
7+
copy_to_gen_with_grd("whats_new_resources") {
88
sources = [ "WNDT.md" ]
99
}
10-
11-
group("whats_new_resources") {
12-
public_deps = [ ":resources-gen" ]
13-
data_deps = public_deps
14-
metadata = {
15-
grd_files = get_target_outputs(":resources-gen")
16-
}
17-
}

scripts/build/ninja/copy.gni

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,29 @@ template("copy_to_gen") {
3131
}
3232
}
3333
}
34+
35+
#
36+
# Same as "copy_to_gen" but includes all output files in the release GRD
37+
#
38+
template("copy_to_gen_with_grd") {
39+
assert(!defined(invoker.testonly),
40+
"Test resources can't be included in the release bundle!")
41+
42+
_copy_target = "${target_name}_gen"
43+
copy_to_gen(_copy_target) {
44+
forward_variables_from(invoker,
45+
[
46+
"sources",
47+
"visibility",
48+
"deps",
49+
])
50+
}
51+
52+
group(target_name) {
53+
public_deps = [ ":$_copy_target" ]
54+
data_deps = public_deps
55+
metadata = {
56+
grd_files = get_target_outputs(":$_copy_target")
57+
}
58+
}
59+
}

0 commit comments

Comments
 (0)