From c8edcf1bb8c89d94e99b85e2942e0a81a8572828 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 19 Nov 2021 13:01:52 -0500 Subject: [PATCH] Split util/net files into a separate static_library target. Only the handler uses util/net. After 8342e6bd613a5b2e44eca1d74288e3115ccef139, the introduction of an Objective-C class caused Chromium to emit duplicate class defintion warnings in the component build. Bug: chromium:1270609 Change-Id: I2770528347aef406bb21a79d295f702498f7b37e Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3290276 Commit-Queue: Robert Sesek Reviewed-by: Mark Mentovai --- handler/BUILD.gn | 1 + tools/BUILD.gn | 1 + util/BUILD.gn | 95 ++++++++++++++++++++++++++++++------------------ 3 files changed, 61 insertions(+), 36 deletions(-) diff --git a/handler/BUILD.gn b/handler/BUILD.gn index f66da69a..e7a49661 100644 --- a/handler/BUILD.gn +++ b/handler/BUILD.gn @@ -112,6 +112,7 @@ static_library("common") { "../client:common", "../snapshot", "../util", + "../util:net", ] if (crashpad_is_win) { cflags = [ "/wd4201" ] # nonstandard extension used : nameless struct/union diff --git a/tools/BUILD.gn b/tools/BUILD.gn index 91e20a03..4069e070 100644 --- a/tools/BUILD.gn +++ b/tools/BUILD.gn @@ -48,6 +48,7 @@ if (!crashpad_is_ios) { "../compat", "$mini_chromium_source_parent:base", "../util", + "../util:net", ] } } diff --git a/util/BUILD.gn b/util/BUILD.gn index 7983dfd8..a376c0c9 100644 --- a/util/BUILD.gn +++ b/util/BUILD.gn @@ -217,17 +217,6 @@ crashpad_static_library("util") { "misc/uuid.h", "misc/zlib.cc", "misc/zlib.h", - "net/http_body.cc", - "net/http_body.h", - "net/http_body_gzip.cc", - "net/http_body_gzip.h", - "net/http_headers.h", - "net/http_multipart_builder.cc", - "net/http_multipart_builder.h", - "net/http_transport.cc", - "net/http_transport.h", - "net/url.cc", - "net/url.h", "numeric/checked_address_range.cc", "numeric/checked_address_range.h", "numeric/checked_range.h", @@ -369,7 +358,6 @@ crashpad_static_library("util") { "mach/scoped_task_suspend.h", "mach/task_for_pid.cc", "mach/task_for_pid.h", - "net/http_transport_mac.mm", "posix/process_info_mac.cc", "process/process_memory_mac.cc", "process/process_memory_mac.h", @@ -397,34 +385,11 @@ crashpad_static_library("util") { "ios/raw_logging.h", "ios/scoped_vm_read.cc", "ios/scoped_vm_read.h", - "net/http_transport_mac.mm", ] } deps = [] - if (crashpad_http_transport_impl == "socket") { - sources += [ "net/http_transport_socket.cc" ] - if (crashpad_use_boringssl_for_http_transport_socket) { - defines += [ "CRASHPAD_USE_BORINGSSL" ] - - if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) { - deps += [ "//third_party/boringssl" ] - } else { - libs = [ - "crypto", - "ssl", - ] - } - } - } else if (crashpad_http_transport_impl == "libcurl") { - sources += [ "net/http_transport_libcurl.cc" ] - if (crashpad_is_in_fuchsia) { - # Host Linux builds in Fuchsia don't have libcurl in a sysroot. - deps += [ "//third_party/curl:libcurl" ] - } - } - if (crashpad_is_android) { sources += [ "linux/initial_signal_dispositions.cc", @@ -488,7 +453,6 @@ crashpad_static_library("util") { "misc/clock_win.cc", "misc/paths_win.cc", "misc/time_win.cc", - "net/http_transport_win.cc", "process/process_memory_win.cc", "process/process_memory_win.h", "synchronization/semaphore_win.cc", @@ -652,12 +616,70 @@ crashpad_static_library("util") { } } +# net is split into a separate target from util so that client code does +# not have to depend on it. +crashpad_static_library("net") { + sources = [ + "net/http_body.cc", + "net/http_body.h", + "net/http_body_gzip.cc", + "net/http_body_gzip.h", + "net/http_headers.h", + "net/http_multipart_builder.cc", + "net/http_multipart_builder.h", + "net/http_transport.cc", + "net/http_transport.h", + "net/url.cc", + "net/url.h", + ] + + deps = [ + ":util", + "$mini_chromium_source_parent:base", + ] + + if (crashpad_is_mac && !crashpad_is_in_fuchsia) { + sources += [ "net/http_transport_mac.mm" ] + } + + if (crashpad_is_ios) { + sources += [ "net/http_transport_mac.mm" ] + } + + if (crashpad_is_win) { + sources += [ "net/http_transport_win.cc" ] + } + + if (crashpad_http_transport_impl == "socket") { + sources += [ "net/http_transport_socket.cc" ] + if (crashpad_use_boringssl_for_http_transport_socket) { + defines += [ "CRASHPAD_USE_BORINGSSL" ] + + if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) { + deps += [ "//third_party/boringssl" ] + } else { + libs = [ + "crypto", + "ssl", + ] + } + } + } else if (crashpad_http_transport_impl == "libcurl") { + sources += [ "net/http_transport_libcurl.cc" ] + if (crashpad_is_in_fuchsia) { + # Host Linux builds in Fuchsia don't have libcurl in a sysroot. + deps += [ "//third_party/curl:libcurl" ] + } + } +} + if (!crashpad_is_android && !crashpad_is_ios) { crashpad_executable("http_transport_test_server") { testonly = true sources = [ "net/http_transport_test_server.cc" ] deps = [ + ":net", ":util", "$mini_chromium_source_parent:base", "../third_party/cpp-httplib", @@ -866,6 +888,7 @@ source_set("util_test") { ] deps = [ + ":net", ":util", "$mini_chromium_source_parent:base", "../client",