Use GN metadata to compute GRD files
GN metadata allows to specify and later query metadata from any
action in our build graph. Using GN metadata, we can specify
GRD files on an action and collect these files on the top level.
Then, we can compare the list of collected files to the expected
GRD files in `devtools_grd_files.gni` to ensure they match.
As a follow-up change, we can remove the intermediate lists we have
been specifying in `all_devtools_modules.gni` and
`devtools_module_entrypoints.gni`, which now become obsolete. That's
because both `devtools_module` and `devtools_entrypoint` now specify
the files in their respective metadata and essentially perform the
check that all relevant files are collected.
[email protected]
Also-By: [email protected]
Bug: 1174013
Change-Id: I9dd2e6f7e010b5c25f83556511af12d5d1c2ec7c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2843322
Commit-Queue: Tim van der Lippe <[email protected]>
Reviewed-by: Alex Rudenko <[email protected]>
Reviewed-by: Paul Lewis <[email protected]>
diff --git a/BUILD.gn b/BUILD.gn
index 7b904ed..bbe2836 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -181,6 +181,56 @@
public_deps = [ "inspector_overlay:build_inspector_overlay" ]
}
+action("assert_grd") {
+ script = "scripts/build/assert_grd.py"
+
+ deps = [
+ ":expected_grd_files",
+ ":input_grd_files",
+ ]
+
+ inputs = [
+ "$target_gen_dir/expected_grd_files.json",
+ "$target_gen_dir/input_grd_files.json",
+ ]
+
+ args = [
+ rebase_path("$target_gen_dir/expected_grd_files.json", root_build_dir),
+ rebase_path("$target_gen_dir/input_grd_files.json", root_build_dir),
+ rebase_path("$target_gen_dir/assert_grd.stamp", root_build_dir),
+ ]
+
+ outputs = [ "$target_gen_dir/assert_grd.stamp" ]
+}
+
+generated_file("expected_grd_files") {
+ outputs = [ "$target_gen_dir/expected_grd_files.json" ]
+
+ _expected_files = []
+ _expected_files += grd_files_release_sources
+ if (is_debug) {
+ _expected_files += grd_files_debug_sources
+ }
+
+ contents = _expected_files
+
+ output_conversion = "json"
+}
+
+generated_file("input_grd_files") {
+ outputs = [ "$target_gen_dir/input_grd_files.json" ]
+
+ data_keys = [ "grd_files" ]
+
+ output_conversion = "json"
+ rebase = root_gen_dir
+
+ deps = [
+ ":build_release_devtools",
+ "front_end",
+ ]
+}
+
action("generate_devtools_grd") {
script = "scripts/build/generate_devtools_grd.py"
@@ -287,4 +337,8 @@
"--output_path_gen",
rebase_path("$target_gen_dir/front_end", root_build_dir),
] + build_release_devtools_args
+
+ metadata = {
+ grd_files = outputs
+ }
}