naiveproxy/components/crash/content/app/BUILD.gn
2018-02-02 05:49:39 -05:00

247 lines
5.9 KiB
Plaintext

# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# TODO(crbug.com/753619): Enable crash reporting on Fuchsia.
assert(!is_ios && !is_fuchsia)
if (is_android) {
import("//build/config/android/config.gni")
}
source_set("lib") {
visibility = [ ":*" ]
sources = [
"crash_reporter_client.cc",
"crash_reporter_client.h",
]
deps = [
"//base",
]
}
static_library("app") {
sources = [
"crash_export_thunks.h",
"crash_switches.cc",
"crash_switches.h",
"crashpad.h",
"crashpad_mac.mm",
"crashpad_win.cc",
]
if (is_mac || is_win) {
sources += [ "crashpad.cc" ]
} else if (is_android || is_linux) {
# Want these files on both Linux and Android.
set_sources_assignment_filter([])
sources += [
"breakpad_linux.cc",
"breakpad_linux.h",
"breakpad_linux_impl.h",
]
}
defines = [ "CRASH_IMPLEMENTATION" ]
public_deps = [
":lib",
]
deps = [
"//base",
]
if (is_mac || is_win) {
deps += [
"//third_party/crashpad/crashpad/client",
"//third_party/crashpad/crashpad/snapshot:snapshot_api",
]
} else if (is_android || is_linux) {
deps += [
"//base:base_static",
"//components/crash/core/common",
"//content/public/common:content_descriptors",
"//content/public/common:result_codes",
"//third_party/breakpad:client",
]
# Clang's -mstackrealign doesn't work well with
# linux_syscall_support.h hand written asm syscalls.
# See https://crbug.com/556393
configs -= [ "//build/config/compiler:clang_stackrealign" ]
}
if (is_win) {
deps += [ "//third_party/crashpad/crashpad/handler" ]
}
if (is_android) {
libs = [ "log" ]
}
}
if (is_win) {
static_library("run_as_crashpad_handler") {
sources = [
"crash_switches.cc",
"crash_switches.h",
"fallback_crash_handler_launcher_win.cc",
"fallback_crash_handler_launcher_win.h",
"fallback_crash_handler_win.cc",
"fallback_crash_handler_win.h",
"fallback_crash_handling_win.cc",
"fallback_crash_handling_win.h",
"run_as_crashpad_handler_win.cc",
"run_as_crashpad_handler_win.h",
]
deps = [
"//base",
"//components/browser_watcher:crash_stability",
"//third_party/crashpad/crashpad/client",
"//third_party/crashpad/crashpad/handler",
"//third_party/crashpad/crashpad/minidump",
]
}
# This source set contains the include file that declares the export thunks.
# Any target that gets compiled into both test and release code needs to
# depend on this for the include alone. The binary it's linked into then needs
# to depend on either :crash_export_thunks or :test_support, or in the case of
# release binaries, on //chrome_elf, which re-exports the thunks.
source_set("crash_export_thunk_include") {
sources = [
"crash_export_thunks.h",
]
}
# This source set contains a set of functions that allow using the crashpad
# handler across a module boundary. The intent is for these functions to be
# built into a dynamic library, which the user of the crashpad handler then
# has a link-time dependency on. This will result in an import dependency
# from the user to the dynamic library that will be bound at load time.
# In a single-module project, this source set can alternatively be included in
# the sole module, in which case the implementation will be bound at link
# time.
source_set("crash_export_thunks") {
sources = [
"crash_export_thunks.cc",
"crash_export_thunks.h",
]
deps = [
":app",
"//base",
"//third_party/crashpad/crashpad/client",
]
}
# This source set contains a set of test stubs for the functions above.
# time.
source_set("crash_export_stubs") {
testonly = true
sources = [
"crash_export_stubs.cc",
"crash_export_thunks.h",
]
deps = [
":app",
"//base",
]
}
}
# This source set provides the functionality required for tests, which on Windows
# link the export thunks directly into the test binary.
source_set("test_support") {
testonly = true
deps = [
":lib",
]
if (is_win) {
deps += [ ":crash_export_stubs" ]
}
}
# TODO(crbug.com/565771): This target and :deprecated_breakpad_win should be
# removed.
if (is_win) {
source_set("lib_breakpad") {
visibility = [ ":*" ]
sources = [
"crash_keys_win.cc",
"crash_keys_win.h",
]
deps = [
":lib",
"//base",
"//third_party/breakpad:breakpad_handler",
]
include_dirs = [ "../../../../third_party/breakpad/breakpad/src" ]
}
static_library("deprecated_breakpad_win") {
visibility = [ "//components/nacl/broker:nacl64" ]
sources = [
"breakpad_win.cc",
"breakpad_win.h",
"hard_error_handler_win.cc",
"hard_error_handler_win.h",
]
defines = [ "CRASH_IMPLEMENTATION" ]
deps = [
":lib",
":lib_breakpad",
"//base",
"//base:base_static",
"//components/crash/core/common",
"//content/public/common:result_codes",
"//sandbox",
"//third_party/breakpad:breakpad_handler",
"//third_party/breakpad:client",
]
libs = [ "userenv.lib" ]
}
}
source_set("unit_tests") {
testonly = true
sources = [
"crash_keys_win_unittest.cc",
"fallback_crash_handler_launcher_win_unittest.cc",
"fallback_crash_handler_win_unittest.cc",
"fallback_crash_handling_win_unittest.cc",
]
deps = [
":lib",
"//base",
"//base/test:test_support",
"//testing/gmock",
"//testing/gtest",
]
if (is_win) {
deps += [
":lib_breakpad",
":run_as_crashpad_handler",
"//third_party/breakpad:client",
"//third_party/crashpad/crashpad/client:client",
"//third_party/crashpad/crashpad/snapshot:snapshot",
"//third_party/crashpad/crashpad/util",
]
}
}