[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_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) {
crashpad_is_mac = is_mac
crashpad_is_ios = is_ios
@ -46,16 +69,8 @@ if (crashpad_is_in_chromium) {
crashpad_is_clang = is_clang
} else {
# External and Dart SDK builds assume crashpad and mini_chromium are peers.
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")
}
import("$mini_chromium_import_root/build/compiler.gni")
crashpad_is_mac = mini_chromium_is_mac
crashpad_is_ios = mini_chromium_is_ios
crashpad_is_win = mini_chromium_is_win

View File

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

View File

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

View File

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

View File

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

View File

@ -124,7 +124,7 @@ static_library("test") {
deps = [
"../compat",
"../third_party/googletest:googletest",
"../third_party/mini_chromium:base",
"$mini_chromium_source_parent:base",
"../util",
]
@ -204,7 +204,7 @@ source_set("test_test") {
"../compat",
"../third_party/googletest:googlemock",
"../third_party/googletest:googletest",
"../third_party/mini_chromium:base",
"$mini_chromium_source_parent:base",
"../util",
]
@ -219,7 +219,7 @@ if (!crashpad_is_ios) {
crashpad_executable("crashpad_test_test_multiprocess_exec_test_child") {
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",
"../third_party/googletest:googlemock",
"../third_party/googletest:googletest",
"../third_party/mini_chromium:base",
"../third_party/mini_chromium:base_test_support",
"$mini_chromium_source_parent:base",
"$mini_chromium_source_parent:base_test_support",
]
if (crashpad_is_android) {
deps += [ "../util" ]
@ -251,8 +251,8 @@ static_library("googletest_main") {
deps = [
":test",
"../third_party/googletest:googletest",
"../third_party/mini_chromium:base",
"../third_party/mini_chromium:base_test_support",
"$mini_chromium_source_parent:base",
"$mini_chromium_source_parent:base_test_support",
]
if (crashpad_is_android) {
deps += [ "../util" ]

View File

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

View File

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

View File

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

View File

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