summaryrefslogtreecommitdiffstats
path: root/components/crash/content/app/BUILD.gn
blob: b4fbe74ca4e99870c7f70573d0567af64a6c8bbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# 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.

if (is_android) {
  import("//build/config/android/config.gni")
}

source_set("lib") {
  sources = [
    "crash_keys_win.cc",
    "crash_keys_win.h",
    "crash_reporter_client.cc",
    "crash_reporter_client.h",
  ]

  include_dirs = [ "../../../../breakpad/src" ]

  deps = [
    "//base",
  ]

  if (is_win) {
    deps += [ "//breakpad:breakpad_handler" ]
  }
}

# GYP version: components/crash.gypi:crash_component
source_set("app") {
  sources = [
    "crashpad.h",
    "crashpad_mac.mm",
    "crashpad_win.cc",
  ]

  if (is_mac || is_win) {
    sources += [ "crashpad.cc" ]
  }

  defines = [ "CRASH_IMPLEMENTATION" ]

  public_deps = [
    ":app_non_mac_win",
  ]
  deps = [
    "//base",
  ]

  deps += [ ":lib" ]
  if (is_mac || is_win) {
    deps += [ "//third_party/crashpad/crashpad/client" ]
  }
}

# TODO(mark): https://crbug.com/466890: merge this target with
# crash_component.
#
# This is a temporary base target that is depended on by both
# crash_component and crash_component_breakpad_mac_to_be_deleted. It
# provides everything common to both of those targets. For a short period,
# there are two Mac crash component implementations. The new one uses a
# Crashpad implementation and is used by Chrome. The old one uses a
# Breakpad implementation and is used by content_shell. Consumers should
# depend on the desired target. All three targets behave identically on
# non-Mac. When content_shell and any other consumers are migrated to the
# Crashpad implementation on Mac, crash_component will merge back into
# this target, crash_component_non_mac, which will be renamed
# crash_component. crash_component_breakpad_mac_to_be_deleted will be
# deleted.
#
# While this situation exists:
#
# Do not depend on this target directly! Depend on
# crash_component_breakpad_mac_to_be_deleted for old Breakpad behavior on
# all platforms, or preferably, depend on crash_component to get Breakpad
# everywhere except for Mac, where you will get Crashpad.
source_set("app_non_mac_win") {
  visibility = [
    ":*",
    "//components/crash/content/browser",
  ]

  sources = [
    "breakpad_linux_impl.h",
    "hard_error_handler_win.cc",
    "hard_error_handler_win.h",
  ]

  if (is_android) {
    libs = [ "log" ]
  }

  if (is_android || is_linux) {
    # Want these files on both Linux and Android.
    set_sources_assignment_filter([])
    sources += [
      "breakpad_linux.cc",
      "breakpad_linux.h",
    ]
  }

  defines = [ "CRASH_IMPLEMENTATION" ]

  deps = [
    ":lib",
    "//base",
    "//base:base_static",
    "//components/crash/core/common",
    "//content/public/common:content_descriptors",
    "//content/public/common:result_codes",
  ]

  if (is_android) {
    defines += [ "CHROME_BUILD_ID=\"$android_chrome_build_id\"" ]
  }

  if (current_cpu == "x86" && is_clang) {
    # Clang's -mstackrealign doesn't work well with
    # linux_syscall_support.h hand written asm syscalls.
    # See https://crbug.com/556393
    cflags -= [ "-mstackrealign" ]
  }

  if (is_win) {
    deps += [
      "//breakpad:breakpad_handler",
      "//sandbox",

      #'../breakpad/breakpad.gyp:breakpad_sender',  TODO(GYP)
    ]
  } else if (is_posix && !is_ios) {
    deps += [ "//breakpad:client" ]
  }
}

# TODO(mark): https://crbug.com/466890: remove this target.
#
# This is a temporary target provided for Mac Breakpad users that have not
# yet migrated to Crashpad (namely content_shell). This target will be
# removed shortly and all consumers will be expected to use Crashpad as
# the Mac crash-reporting client. See the comment in the
# crash_component_non_mac target for more details.
source_set("app_breakpad_mac_win_to_be_deleted") {
  deps = [
    ":app_non_mac_win",
  ]

  if (is_mac || is_win) {
    sources = [
      "breakpad_mac.h",
      "breakpad_mac.mm",
      "breakpad_win.cc",
      "breakpad_win.h",
    ]

    defines = [ "CRASH_IMPLEMENTATION" ]

    deps += [
      ":lib",
      "//base",
      "//base:base_static",
      "//breakpad:client",
      "//components/crash/core/common",
      "//content/public/common:result_codes",
      "//sandbox",
    ]

    if (is_mac) {
      deps += [ "//breakpad" ]
    }

    if (is_win) {
      deps += [ "//breakpad:breakpad_handler" ]
    }
  }
}