diff --git a/.gn b/.gn index 64dbcb82086d96..87d23636b0b723 100644 --- a/.gn +++ b/.gn @@ -56,6 +56,8 @@ default_args = { angle_vulkan_tools_dir = "//third_party/vulkan-deps/vulkan-tools/src" angle_vulkan_validation_layers_dir = "//third_party/vulkan-deps/vulkan-validation-layers/src" + + devtools_visibility = [ "*" ] } # These are the targets to skip header checking by default. The files in targets diff --git a/build/config/devtools.gni b/build/config/devtools.gni index d54aa1e9927bfa..7a6d2b2f06f4c6 100644 --- a/build/config/devtools.gni +++ b/build/config/devtools.gni @@ -2,17 +2,36 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/chrome_build.gni") import("//build_overrides/build.gni") declare_args() { if (build_with_chromium) { - # This argument is used in DevTools to resolve to the correct location + # devtools_location is used in DevTools to resolve to the correct location # for any script/file referenced in the DevTools build scripts. Since # DevTools supports both a standalone build and build integration with # Chromium, we need to differentiate between the two versions. - devtools_location = "third_party/devtools-frontend/src/" + # devtools_location points to the Chromium version in both Chrome-branded + # and not Chrome-branded builds. devtools_root_location points to the root + # of the Chrome-branded version when is_chrome_branded is true and to the root + # of the Chromium version when is_chrome_branded is false. + # devtools_grd_location is the location of the GRD file listing all DevTools + # resources. + if (is_chrome_branded) { + devtools_root_location = "third_party/devtools-frontend-internal" + devtools_location = "$devtools_root_location/devtools-frontend/" + devtools_grd_location = + "$devtools_root_location/chrome_devtools_resources.grd" + } else { + devtools_root_location = "third_party/devtools-frontend/src" + devtools_location = "third_party/devtools-frontend/src/" + devtools_grd_location = + "$devtools_root_location/front_end/devtools_resources.grd" + } } else { # DevTools is building a standalone version devtools_location = "" + devtools_root_location = "" + devtools_grd_location = "" } } diff --git a/content/browser/devtools/BUILD.gn b/content/browser/devtools/BUILD.gn index 743cd13d2ff313..74cdc1431602a3 100644 --- a/content/browser/devtools/BUILD.gn +++ b/content/browser/devtools/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/devtools.gni") import("//components/viz/common/debugger/viz_debugger.gni") import("//third_party/inspector_protocol/inspector_protocol.gni") import("//third_party/protobuf/proto_library.gni") @@ -10,7 +11,7 @@ import("//tools/grit/grit_rule.gni") # Android does not support DevTools front-end. if (!is_android) { grit("devtools_resources") { - source = "$root_gen_dir/third_party/devtools-frontend/src/front_end/devtools_resources.grd" + source = "$root_gen_dir/$devtools_grd_location" # Required because the .grd is generated. enable_input_discovery_for_gn_analyze = false diff --git a/third_party/blink/public/BUILD.gn b/third_party/blink/public/BUILD.gn index 04a01b50edb45f..9fb1ac96f32477 100644 --- a/third_party/blink/public/BUILD.gn +++ b/third_party/blink/public/BUILD.gn @@ -4,6 +4,7 @@ import("//build/buildflag_header.gni") import("//build/config/dcheck_always_on.gni") +import("//build/config/devtools.gni") import("//mojo/public/tools/bindings/mojom.gni") import("//third_party/blink/public/public_features.gni") import("//third_party/blink/renderer/config.gni") @@ -473,7 +474,7 @@ source_set("blink_headers") { ] } -devtools_frontend_path = "//third_party/devtools-frontend/src" +devtools_frontend_path = "//$devtools_root_location" group("blink_devtools_frontend_resources") { public_deps = [ "$devtools_frontend_path:devtools_frontend_resources" ] @@ -514,8 +515,15 @@ grit("devtools_inspector_resources") { "inspector_overlay_resources.pak", ] - defines = - [ "SHARED_INTERMEDIATE_DIR=" + rebase_path(root_out_dir, root_build_dir) ] + _shared_intermediate_dir = rebase_path(root_out_dir, root_build_dir) + _devtools_grd_path = "$shared_intermediate_dir/$devtools_grd_location" + _devtools_grd_path_no_ext = get_path_info(_devtools_grd_path, "dir") + "/" + + get_path_info(_devtools_grd_path, "name") + + defines = [ + "SHARED_INTERMEDIATE_DIR=" + _shared_intermediate_dir, + "DEVTOOLS_GRD_PATH=" + _devtools_grd_path_no_ext, + ] deps = [ "$devtools_frontend_path:generate_devtools_inspector_overlay_resources", diff --git a/tools/grit/grit_defines.gni b/tools/grit/grit_defines.gni index 0039f04a75ef25..497bc384ee79f1 100644 --- a/tools/grit/grit_defines.gni +++ b/tools/grit/grit_defines.gni @@ -5,15 +5,23 @@ import("//build/config/chrome_build.gni") import("//build/config/chromeos/ui_mode.gni") import("//build/config/crypto.gni") +import("//build/config/devtools.gni") import("//build/config/ui.gni") +shared_intermediate_dir = rebase_path(root_gen_dir, root_build_dir) +devtools_grd_path = "$shared_intermediate_dir/$devtools_grd_location" +devtools_grd_path_no_ext = get_path_info(devtools_grd_path, "dir") + "/" + + get_path_info(devtools_grd_path, "name") + grit_defines = [ "-E", "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), "-E", "root_src_dir=" + rebase_path("//", root_build_dir), "-D", - "SHARED_INTERMEDIATE_DIR=" + rebase_path(root_gen_dir, root_build_dir), + "SHARED_INTERMEDIATE_DIR=" + shared_intermediate_dir, + "-D", + "DEVTOOLS_GRD_PATH=" + devtools_grd_path_no_ext, ] if (is_mac || is_win || is_linux || is_chromeos || is_ios) { diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec index f0e44402d8ace3..81ea6ca1262f19 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec @@ -837,7 +837,8 @@ }, # This file is generated during the build. - "<(SHARED_INTERMEDIATE_DIR)/third_party/devtools-frontend/src/front_end/devtools_resources.grd": { + # .grd extension is required because it's checked before var interpolation. + "<(DEVTOOLS_GRD_PATH).grd": { # In debug build, devtools frontend sources are not bundled and therefore # includes a lot of individual resources "META": {"sizes": {"includes": [2000],}},