Adds global list of files expected for the GRD
We've found that files missed from the GRD cause issues in Chromium,
since it looks to the GRD/pak in order to serve the DevTools frontend.
Standalone builds of the DevTools frontend (as well as using
--custom-devtools-frontend in Chromium) do not present with the issue,
since in those cases the files are loaded directly from disk (rather
than via the GRD/pak file).
This CL introduces two new lists: a global list of files required for
the Release build (is_debug=false) of Chromium, and a second list of
files required for the Debug build (is_debug=true). These lists are
cross-referenced to ensure no overlap, thus in Release we use the first
list, and in Debug we use both.
In the root BUILD.gn we now check that files that are inputted to the
GRD builder action map exactly to the list of files expected for the
GRD, and any mismatch causes a build failure.
[email protected]
DISABLE_THIRD_PARTY_CHECK=Adding owners and file at the same time
Change-Id: I5e215eb5dc249123ab07210baa3eeb00da225410
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2324586
Commit-Queue: Paul Lewis <[email protected]>
Reviewed-by: Daniel Clifford <[email protected]>
Reviewed-by: Simon Zünd <[email protected]>
Reviewed-by: Paul Lewis <[email protected]>
Reviewed-by: Jack Franklin <[email protected]>
diff --git a/BUILD.gn b/BUILD.gn
index cdd4693..2e271bb 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -5,6 +5,7 @@
import("//third_party/blink/public/public_features.gni")
import("./all_devtools_files.gni")
import("./all_devtools_modules.gni")
+import("./devtools_grd_files.gni")
import("./devtools_image_files.gni")
import("./devtools_module_entrypoints.gni")
import("./scripts/build/ninja/vars.gni")
@@ -342,6 +343,36 @@
]
inputs = grd_files + front_end_image_files
+
+ # Confirm that the files in the inputs match expectations.
+ # There is some path wrangling necessary here because some paths come with
+ # //out/{Target} at the start, others with front_end
+ _normalized_inputs = []
+ foreach(input, inputs) {
+ _normalized_inputs +=
+ [ string_replace(input, resources_out_dir, "front_end") ]
+ }
+
+ # Always assume the release files are included.
+ _expected_files = []
+ _expected_files += grd_files_release_sources
+ if (is_debug) {
+ _expected_files += grd_files_debug_sources
+ }
+
+ # Remove the inputs from the expectations, any leftovers means that not all inputs were provided.
+ _missing_files_expected = filter_exclude(_expected_files, _normalized_inputs)
+ assert(
+ _missing_files_expected == [],
+ "Files were expected that weren't found in the GRD inputs: $_missing_files_expected")
+
+ # Remove the expectations from the inputs, any leftovers means that too many files were provided.
+ _missing_files_normalized =
+ filter_exclude(_normalized_inputs, _expected_files)
+ assert(
+ _missing_files_normalized == [],
+ "Files were provided that weren't expected in the GRD inputs: $_missing_files_normalized")
+
response_file_contents = rebase_path(grd_files, root_build_dir)
outfile = "$root_gen_dir/devtools/devtools_resources.grd"
outputs = [ outfile ]