From 828095ac32f36765cc2e0d94f4761f6eacff559e Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Tue, 7 Jul 2020 23:26:07 -0400 Subject: [PATCH] Clear the gn sources_assignment_filter when building in Chromium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Chromium relies on a global gn sources assignment filter, even though it’s kind of discouraged. Crashpad doesn’t use this, instead selecting which files to build entirely with the logic in its .gn files. In some cases, Chromium’s filters prevent _linux files from building on Android, and _mac files from building on iOS, even though Crashpad’s build has explicitly requested these inclusions. To overcome this problem, clear the gn sources_assignment_filter in all of Crashpad’s own .gn files when building in Chromium. Change-Id: Iab0af29f4e5aff4be8eec2ee12b2e3f991c0a86d Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2285959 Commit-Queue: Mark Mentovai Reviewed-by: Rohit Rao --- BUILD.gn | 5 +++++ build/crashpad_buildconfig.gni | 4 ++-- client/BUILD.gn | 6 +++++- compat/BUILD.gn | 5 +++++ handler/BUILD.gn | 7 +++++-- minidump/BUILD.gn | 5 +++++ test/BUILD.gn | 6 +++++- test/ios/BUILD.gn | 3 +++ test/ios/host/BUILD.gn | 3 +++ tools/BUILD.gn | 5 +++++ 10 files changed, 43 insertions(+), 6 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 1e44a857..7d2f0a12 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -16,6 +16,11 @@ import("build/crashpad_buildconfig.gni") import("build/test.gni") import("util/net/tls.gni") +if (crashpad_is_in_chromium) { + # Prevent Chromium source assignment filters from being inherited. + set_sources_assignment_filter([]) +} + config("crashpad_config") { include_dirs = [ "." ] } diff --git a/build/crashpad_buildconfig.gni b/build/crashpad_buildconfig.gni index 7540fb28..d919a8b4 100644 --- a/build/crashpad_buildconfig.gni +++ b/build/crashpad_buildconfig.gni @@ -51,8 +51,8 @@ if (crashpad_is_in_chromium) { 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. + # 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") } diff --git a/client/BUILD.gn b/client/BUILD.gn index 32b47fd5..a74ddc3f 100644 --- a/client/BUILD.gn +++ b/client/BUILD.gn @@ -14,6 +14,11 @@ import("../build/crashpad_buildconfig.gni") +if (crashpad_is_in_chromium) { + # Prevent Chromium source assignment filters from being inherited. + set_sources_assignment_filter([]) +} + static_library("client") { sources = [ "annotation.cc", @@ -51,7 +56,6 @@ static_library("client") { } if (crashpad_is_linux || crashpad_is_android) { - set_sources_assignment_filter([]) sources += [ "crashpad_client_linux.cc", "simulate_crash_linux.h", diff --git a/compat/BUILD.gn b/compat/BUILD.gn index 9c22acfc..ba9d78cd 100644 --- a/compat/BUILD.gn +++ b/compat/BUILD.gn @@ -14,6 +14,11 @@ import("../build/crashpad_buildconfig.gni") +if (crashpad_is_in_chromium) { + # Prevent Chromium source assignment filters from being inherited. + set_sources_assignment_filter([]) +} + config("compat_config") { include_dirs = [] diff --git a/handler/BUILD.gn b/handler/BUILD.gn index 51ff2cf2..472c1477 100644 --- a/handler/BUILD.gn +++ b/handler/BUILD.gn @@ -14,6 +14,11 @@ import("../build/crashpad_buildconfig.gni") +if (crashpad_is_in_chromium) { + # Prevent Chromium source assignment filters from being inherited. + set_sources_assignment_filter([]) +} + static_library("handler") { sources = [ "crash_report_upload_thread.cc", @@ -40,7 +45,6 @@ static_library("handler") { } if (crashpad_is_linux || crashpad_is_android) { - set_sources_assignment_filter([]) sources += [ "linux/capture_snapshot.cc", "linux/capture_snapshot.h", @@ -169,7 +173,6 @@ if (crashpad_is_android) { } crashpad_executable("crashpad_handler_trampoline") { - set_sources_assignment_filter([]) output_name = "libcrashpad_handler_trampoline.so" sources = [ "linux/handler_trampoline.cc" ] diff --git a/minidump/BUILD.gn b/minidump/BUILD.gn index 88227646..804f39f7 100644 --- a/minidump/BUILD.gn +++ b/minidump/BUILD.gn @@ -14,6 +14,11 @@ import("../build/crashpad_buildconfig.gni") +if (crashpad_is_in_chromium) { + # Prevent Chromium source assignment filters from being inherited. + set_sources_assignment_filter([]) +} + static_library("minidump") { sources = [ "minidump_annotation_writer.cc", diff --git a/test/BUILD.gn b/test/BUILD.gn index 7b052f0a..69ba5b44 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -14,6 +14,11 @@ import("../build/crashpad_buildconfig.gni") +if (crashpad_is_in_chromium) { + # Prevent Chromium source assignment filters from being inherited. + set_sources_assignment_filter([]) +} + static_library("test") { testonly = true @@ -84,7 +89,6 @@ static_library("test") { } if (crashpad_is_linux || crashpad_is_android) { - set_sources_assignment_filter([]) sources += [ "linux/fake_ptrace_connection.cc", "linux/fake_ptrace_connection.h", diff --git a/test/ios/BUILD.gn b/test/ios/BUILD.gn index 59dd35d5..cbf8ef89 100644 --- a/test/ios/BUILD.gn +++ b/test/ios/BUILD.gn @@ -16,6 +16,9 @@ import("../../build/crashpad_buildconfig.gni") if (crashpad_is_in_chromium) { import("//build/config/ios/rules.gni") + + # Prevent Chromium source assignment filters from being inherited. + set_sources_assignment_filter([]) } else if (crashpad_is_standalone) { import("//third_party/mini_chromium/mini_chromium/build/ios/rules.gni") } diff --git a/test/ios/host/BUILD.gn b/test/ios/host/BUILD.gn index 20f25003..0a14f179 100644 --- a/test/ios/host/BUILD.gn +++ b/test/ios/host/BUILD.gn @@ -16,6 +16,9 @@ import("../../../build/crashpad_buildconfig.gni") if (crashpad_is_in_chromium) { import("//build/config/ios/rules.gni") + + # Prevent Chromium source assignment filters from being inherited. + set_sources_assignment_filter([]) } else if (crashpad_is_standalone) { import("//third_party/mini_chromium/mini_chromium/build/ios/rules.gni") } diff --git a/tools/BUILD.gn b/tools/BUILD.gn index 7da109bc..592e0ad5 100644 --- a/tools/BUILD.gn +++ b/tools/BUILD.gn @@ -14,6 +14,11 @@ import("../build/crashpad_buildconfig.gni") +if (crashpad_is_in_chromium) { + # Prevent Chromium source assignment filters from being inherited. + set_sources_assignment_filter([]) +} + source_set("tool_support") { sources = [ "tool_support.cc",