[third_party] Make mini_chromium relocatable

This will accommodate moving third_party/mini_chromium around.
The default location is unchanged for now.

There are GN variables that may need to be updated when Fuchsia's source
re-organizes its layout:

* mini_chromium_source_parent : this contains a BUILD.gn with groups and
encloses the mini_chromium_source_root.  This is controlled by the
structure of the project that depends on this project.

* _mini_chromium_source_root : this is what is normally checked out from
git, the upstream source directory

* mini_chromium_import_root : points inside source_root to make GN files
accessible.

This first step breaks out case logic for "if (crashpad_is_in_fuchsia)"
even if the value is unchanged for now.  This will faciliate a smaller
change when Fuchsia re-structures third_party sources.

Change-Id: I09e5362f4be8fdb440e3891422881b1053052341
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3062424
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
This commit is contained in:
David Fang 2021-07-28 23:57:54 +00:00 committed by Crashpad LUCI CQ
parent ecefe3cd28
commit d5d78c1469
10 changed files with 76 additions and 60 deletions

View File

@ -34,6 +34,29 @@ crashpad_is_in_dart = crashpad_dependencies == "dart"
crashpad_is_external = crashpad_dependencies == "external" crashpad_is_external = crashpad_dependencies == "external"
crashpad_is_standalone = crashpad_dependencies == "standalone" crashpad_is_standalone = crashpad_dependencies == "standalone"
# This is the parent directory that contains the mini_chromium source dir.
# This variable is not used when crashpad_is_in_chromium.
if (crashpad_is_external || crashpad_is_in_dart) {
# External and Dart SDK builds assume crashpad and mini_chromium are peers.
mini_chromium_source_parent = "../mini_chromium"
} else if (crashpad_is_in_fuchsia) {
mini_chromium_source_parent = "../third_party/mini_chromium"
} else {
mini_chromium_source_parent = "../third_party/mini_chromium"
}
# This is the source directory of mini_chromium (what is checked out).
_mini_chromium_source_root = "$mini_chromium_source_parent/mini_chromium"
# This references the mini_chromium location for importing GN files.
if (crashpad_is_external || crashpad_is_in_dart) {
mini_chromium_import_root = "../../$_mini_chromium_source_root"
} else if (crashpad_is_in_fuchsia) {
mini_chromium_import_root = _mini_chromium_source_root
} else {
mini_chromium_import_root = _mini_chromium_source_root
}
if (crashpad_is_in_chromium) { if (crashpad_is_in_chromium) {
crashpad_is_mac = is_mac crashpad_is_mac = is_mac
crashpad_is_ios = is_ios crashpad_is_ios = is_ios
@ -46,16 +69,8 @@ if (crashpad_is_in_chromium) {
crashpad_is_clang = is_clang crashpad_is_clang = is_clang
} else { } else {
# External and Dart SDK builds assume crashpad and mini_chromium are peers. import("$mini_chromium_import_root/build/compiler.gni")
if (crashpad_is_external || crashpad_is_in_dart) {
import("../../../mini_chromium/mini_chromium/build/compiler.gni")
import("../../../mini_chromium/mini_chromium/build/platform.gni")
} else {
# Both standalone and in Fuchsia tree use mini_chromium, and it's mapped
# into the same location in both cases.
import("../third_party/mini_chromium/mini_chromium/build/compiler.gni")
import("../third_party/mini_chromium/mini_chromium/build/platform.gni")
}
crashpad_is_mac = mini_chromium_is_mac crashpad_is_mac = mini_chromium_is_mac
crashpad_is_ios = mini_chromium_is_ios crashpad_is_ios = mini_chromium_is_ios
crashpad_is_win = mini_chromium_is_win crashpad_is_win = mini_chromium_is_win

View File

@ -66,13 +66,13 @@ crashpad_static_library("client") {
public_deps = [ public_deps = [
":common", ":common",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
deps = [ deps = [
":common", ":common",
"../third_party/mini_chromium:chromeos_buildflags", "$mini_chromium_source_parent:chromeos_buildflags",
] ]
if (crashpad_is_win) { if (crashpad_is_win) {
@ -132,7 +132,7 @@ static_library("common") {
public_configs = [ "..:crashpad_config" ] public_configs = [ "..:crashpad_config" ]
public_deps = [ public_deps = [
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
deps = [ "../util" ] deps = [ "../util" ]
@ -181,7 +181,7 @@ source_set("client_test") {
"../test", "../test",
"../third_party/googletest:googlemock", "../third_party/googletest:googlemock",
"../third_party/googletest:googletest", "../third_party/googletest:googletest",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]

View File

@ -145,7 +145,7 @@ compat_target("compat") {
] ]
if (!crashpad_is_win) { if (!crashpad_is_win) {
public_deps = [ "../third_party/mini_chromium:base" ] public_deps = [ "$mini_chromium_source_parent:base" ]
} }
deps = [ "../util:no_cfi_icall" ] deps = [ "../util:no_cfi_icall" ]

View File

@ -75,7 +75,7 @@ crashpad_static_library("minidump") {
deps = [ deps = [
"../snapshot", "../snapshot",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
@ -101,7 +101,7 @@ static_library("format") {
deps = [ deps = [
"../snapshot:context", "../snapshot:context",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
} }
@ -136,7 +136,7 @@ static_library("test_support") {
"../snapshot:test_support", "../snapshot:test_support",
"../test", "../test",
"../third_party/googletest:googletest", "../third_party/googletest:googletest",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
@ -179,7 +179,7 @@ source_set("minidump_test") {
"../snapshot:test_support", "../snapshot:test_support",
"../test", "../test",
"../third_party/googletest:googletest", "../third_party/googletest:googletest",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]

View File

@ -247,7 +247,7 @@ crashpad_static_library("snapshot") {
"../client:common", "../client:common",
"../compat", "../compat",
"../minidump:format", "../minidump:format",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
@ -269,7 +269,7 @@ static_library("context") {
public_configs = [ "..:crashpad_config" ] public_configs = [ "..:crashpad_config" ]
deps = [ deps = [
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
@ -284,7 +284,7 @@ if (crashpad_is_linux) {
deps = [ deps = [
":snapshot", ":snapshot",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util:util", "../util:util",
] ]
seed_corpus = "elf/elf_image_reader_fuzzer_corpus" seed_corpus = "elf/elf_image_reader_fuzzer_corpus"
@ -319,7 +319,7 @@ static_library("test_support") {
deps = [ deps = [
"../compat", "../compat",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
@ -435,7 +435,7 @@ source_set("snapshot_test") {
"../test", "../test",
"../third_party/googletest:googlemock", "../third_party/googletest:googlemock",
"../third_party/googletest:googletest", "../third_party/googletest:googletest",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
@ -490,7 +490,7 @@ crashpad_loadable_module("crashpad_snapshot_test_module") {
sources = [ "crashpad_info_client_options_test_module.cc" ] sources = [ "crashpad_info_client_options_test_module.cc" ]
deps = [ deps = [
"../client", "../client",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
] ]
} }
@ -505,7 +505,7 @@ crashpad_loadable_module("crashpad_snapshot_test_module_large") {
} }
defines = [ "CRASHPAD_INFO_SIZE_TEST_MODULE_LARGE" ] defines = [ "CRASHPAD_INFO_SIZE_TEST_MODULE_LARGE" ]
deps += [ "../third_party/mini_chromium:base" ] deps += [ "$mini_chromium_source_parent:base" ]
} }
crashpad_loadable_module("crashpad_snapshot_test_module_small") { crashpad_loadable_module("crashpad_snapshot_test_module_small") {
@ -519,7 +519,7 @@ crashpad_loadable_module("crashpad_snapshot_test_module_small") {
} }
defines = [ "CRASHPAD_INFO_SIZE_TEST_MODULE_SMALL" ] defines = [ "CRASHPAD_INFO_SIZE_TEST_MODULE_SMALL" ]
deps += [ "../third_party/mini_chromium:base" ] deps += [ "$mini_chromium_source_parent:base" ]
} }
if ((crashpad_is_linux || crashpad_is_android || crashpad_is_fuchsia) && if ((crashpad_is_linux || crashpad_is_android || crashpad_is_fuchsia) &&
@ -554,7 +554,7 @@ if (crashpad_is_win) {
deps = [ deps = [
"../client", "../client",
"../compat", "../compat",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
] ]
} }
@ -564,7 +564,7 @@ if (crashpad_is_win) {
deps = [ deps = [
"../client", "../client",
"../compat", "../compat",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
} }
@ -575,7 +575,7 @@ if (crashpad_is_win) {
deps = [ deps = [
"../client", "../client",
"../compat", "../compat",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
} }
@ -586,7 +586,7 @@ if (crashpad_is_win) {
deps = [ deps = [
"../client", "../client",
"../compat", "../compat",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
] ]
} }
@ -596,7 +596,7 @@ if (crashpad_is_win) {
deps = [ deps = [
"../client", "../client",
"../compat", "../compat",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
if (crashpad_is_in_chromium) { if (crashpad_is_in_chromium) {
@ -614,7 +614,7 @@ if (crashpad_is_win) {
sources = [ "win/crashpad_snapshot_test_image_reader_module.cc" ] sources = [ "win/crashpad_snapshot_test_image_reader_module.cc" ]
deps = [ deps = [
"../client", "../client",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
] ]
if (crashpad_is_in_chromium) { if (crashpad_is_in_chromium) {
if (symbol_level == 0) { if (symbol_level == 0) {

View File

@ -124,7 +124,7 @@ static_library("test") {
deps = [ deps = [
"../compat", "../compat",
"../third_party/googletest:googletest", "../third_party/googletest:googletest",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
@ -204,7 +204,7 @@ source_set("test_test") {
"../compat", "../compat",
"../third_party/googletest:googlemock", "../third_party/googletest:googlemock",
"../third_party/googletest:googletest", "../third_party/googletest:googletest",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
@ -219,7 +219,7 @@ if (!crashpad_is_ios) {
crashpad_executable("crashpad_test_test_multiprocess_exec_test_child") { crashpad_executable("crashpad_test_test_multiprocess_exec_test_child") {
sources = [ "multiprocess_exec_test_child.cc" ] sources = [ "multiprocess_exec_test_child.cc" ]
deps = [ "../third_party/mini_chromium:base" ] deps = [ "$mini_chromium_source_parent:base" ]
} }
} }
@ -232,8 +232,8 @@ static_library("googlemock_main") {
":test", ":test",
"../third_party/googletest:googlemock", "../third_party/googletest:googlemock",
"../third_party/googletest:googletest", "../third_party/googletest:googletest",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../third_party/mini_chromium:base_test_support", "$mini_chromium_source_parent:base_test_support",
] ]
if (crashpad_is_android) { if (crashpad_is_android) {
deps += [ "../util" ] deps += [ "../util" ]
@ -251,8 +251,8 @@ static_library("googletest_main") {
deps = [ deps = [
":test", ":test",
"../third_party/googletest:googletest", "../third_party/googletest:googletest",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../third_party/mini_chromium:base_test_support", "$mini_chromium_source_parent:base_test_support",
] ]
if (crashpad_is_android) { if (crashpad_is_android) {
deps += [ "../util" ] deps += [ "../util" ]

View File

@ -41,7 +41,7 @@ source_set("google_test_runner") {
"../../build:ios_enable_arc", "../../build:ios_enable_arc",
"../../build:ios_xctest", "../../build:ios_xctest",
"../../test/ios:google_test_runner_shared_headers", "../../test/ios:google_test_runner_shared_headers",
"../../third_party/mini_chromium:base", "../$mini_chromium_source_parent:base",
] ]
frameworks = [ "UIKit.framework" ] frameworks = [ "UIKit.framework" ]
} }
@ -57,7 +57,7 @@ source_set("google_test_setup") {
":google_test_runner_shared_headers", ":google_test_runner_shared_headers",
"../../build:ios_enable_arc", "../../build:ios_enable_arc",
"../../third_party/googletest:googletest", "../../third_party/googletest:googletest",
"../../third_party/mini_chromium:base", "../$mini_chromium_source_parent:base",
] ]
frameworks = [ "UIKit.framework" ] frameworks = [ "UIKit.framework" ]
} }

View File

@ -17,7 +17,9 @@ import("../../build/crashpad_buildconfig.gni")
group("base") { group("base") {
if (crashpad_is_in_chromium) { if (crashpad_is_in_chromium) {
public_deps = [ "//base" ] public_deps = [ "//base" ]
} else if (crashpad_is_standalone || crashpad_is_in_fuchsia) { } else if (crashpad_is_standalone) {
public_deps = [ "mini_chromium/base" ]
} else if (crashpad_is_in_fuchsia) {
public_deps = [ "mini_chromium/base" ] public_deps = [ "mini_chromium/base" ]
} else if (crashpad_is_external) { } else if (crashpad_is_external) {
public_deps = [ "../../../../mini_chromium/mini_chromium/base" ] public_deps = [ "../../../../mini_chromium/mini_chromium/base" ]

View File

@ -22,7 +22,7 @@ source_set("tool_support") {
public_configs = [ "..:crashpad_config" ] public_configs = [ "..:crashpad_config" ]
deps = [ "../third_party/mini_chromium:base" ] deps = [ "$mini_chromium_source_parent:base" ]
} }
if (!crashpad_is_ios) { if (!crashpad_is_ios) {
@ -34,7 +34,7 @@ if (!crashpad_is_ios) {
"../build:default_exe_manifest_win", "../build:default_exe_manifest_win",
"../client", "../client",
"../compat", "../compat",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
} }
@ -46,7 +46,7 @@ if (!crashpad_is_ios) {
":tool_support", ":tool_support",
"../build:default_exe_manifest_win", "../build:default_exe_manifest_win",
"../compat", "../compat",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
} }
@ -57,7 +57,7 @@ crashpad_executable("base94_encoder") {
deps = [ deps = [
":tool_support", ":tool_support",
"../build:default_exe_manifest_win", "../build:default_exe_manifest_win",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
} }
@ -72,7 +72,7 @@ if (!crashpad_is_fuchsia && !crashpad_is_ios) {
"../compat", "../compat",
"../minidump", "../minidump",
"../snapshot", "../snapshot",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
@ -104,7 +104,7 @@ if (crashpad_is_mac || crashpad_is_fuchsia) {
":tool_support", ":tool_support",
"../client", "../client",
"../compat", "../compat",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
} }
@ -117,7 +117,7 @@ if (crashpad_is_mac) {
deps = [ deps = [
":tool_support", ":tool_support",
"../compat", "../compat",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
} }
@ -138,7 +138,7 @@ if (crashpad_is_mac) {
deps = [ deps = [
":tool_support", ":tool_support",
"../compat", "../compat",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
} }
@ -154,7 +154,7 @@ if (crashpad_is_mac) {
deps = [ deps = [
":tool_support", ":tool_support",
"../compat", "../compat",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../util", "../util",
] ]
} }

View File

@ -22,10 +22,8 @@ if (crashpad_is_in_chromium) {
if (crashpad_is_mac || crashpad_is_ios) { if (crashpad_is_mac || crashpad_is_ios) {
if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) { if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) {
import("//build/config/sysroot.gni") import("//build/config/sysroot.gni")
} else if (crashpad_is_external) {
import("../../../mini_chromium/mini_chromium/build/sysroot.gni")
} else { } else {
import("//third_party/mini_chromium/mini_chromium/build/sysroot.gni") import("$mini_chromium_import_root/build/sysroot.gni")
} }
action_foreach("mig") { action_foreach("mig") {
@ -610,8 +608,8 @@ crashpad_static_library("util") {
] ]
deps += [ deps += [
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../third_party/mini_chromium:chromeos_buildflags", "$mini_chromium_source_parent:chromeos_buildflags",
] ]
if (crashpad_is_mac || crashpad_is_ios) { if (crashpad_is_mac || crashpad_is_ios) {
@ -664,11 +662,12 @@ if (!crashpad_is_android && !crashpad_is_ios) {
deps = [ deps = [
":util", ":util",
"../third_party/cpp-httplib", "../third_party/cpp-httplib",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../third_party/zlib", "../third_party/zlib",
"../tools:tool_support", "../tools:tool_support",
] ]
# TODO(b/189353575): make these relocatable using $mini_chromium_ variables
if (crashpad_is_standalone) { if (crashpad_is_standalone) {
remove_configs = [ "//third_party/mini_chromium/mini_chromium/build/config:Wexit_time_destructors" ] remove_configs = [ "//third_party/mini_chromium/mini_chromium/build/config:Wexit_time_destructors" ]
} else if (crashpad_is_external) { } else if (crashpad_is_external) {
@ -699,7 +698,7 @@ if (!crashpad_is_android && !crashpad_is_ios) {
source_set("no_cfi_icall") { source_set("no_cfi_icall") {
sources = [ "misc/no_cfi_icall.h" ] sources = [ "misc/no_cfi_icall.h" ]
public_configs = [ "..:crashpad_config" ] public_configs = [ "..:crashpad_config" ]
public_deps = [ "../third_party/mini_chromium:build" ] public_deps = [ "$mini_chromium_source_parent:build" ]
} }
source_set("util_test") { source_set("util_test") {
@ -876,7 +875,7 @@ source_set("util_test") {
"../test", "../test",
"../third_party/googletest:googlemock", "../third_party/googletest:googlemock",
"../third_party/googletest:googletest", "../third_party/googletest:googletest",
"../third_party/mini_chromium:base", "$mini_chromium_source_parent:base",
"../third_party/zlib", "../third_party/zlib",
] ]