chromium/components/gwp_asan/crash_handler/BUILD.gn

# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//components/gwp_asan/buildflags/buildflags.gni")
import("//third_party/protobuf/proto_library.gni")

static_library("crash_handler") {
  sources = [
    "crash_analyzer.cc",
    "crash_analyzer.h",
    "crash_handler.cc",
    "crash_handler.h",
  ]

  deps = [
    ":crash_proto",
    "//base",
    "//components/gwp_asan/common",
    "//components/gwp_asan/common:crash_keys",
    "//third_party/crashpad/crashpad/client",
    "//third_party/crashpad/crashpad/handler",
    "//third_party/crashpad/crashpad/minidump",
    "//third_party/crashpad/crashpad/snapshot",
    "//third_party/crashpad/crashpad/util",
    "//third_party/protobuf:protobuf_lite",
  ]
}

proto_library("crash_proto") {
  sources = [ "crash.proto" ]
}

source_set("unit_tests") {
  testonly = true
  sources = [ "crash_analyzer_unittest.cc" ]

  deps = [
    ":crash_handler",
    ":crash_proto",
    "//base/test:test_support",
    "//components/gwp_asan/client",
    "//components/gwp_asan/common",
    "//components/gwp_asan/common:crash_keys",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/crashpad/crashpad/client",
    "//third_party/crashpad/crashpad/snapshot",
    "//third_party/crashpad/crashpad/snapshot:test_support",
    "//third_party/crashpad/crashpad/test",
    "//third_party/crashpad/crashpad/util",
    "//third_party/protobuf:protobuf_lite",
  ]

  if (!is_android || enable_gwp_asan) {
    sources += [ "crash_handler_unittest.cc" ]
    deps += [
      "//third_party/crashpad/crashpad/handler",
      "//third_party/crashpad/crashpad/minidump",
      "//third_party/crashpad/crashpad/tools:tool_support",
    ]

    if (is_android) {
      metadata = {
        shared_libraries = [ "$root_out_dir/libchrome_crashpad_handler.so" ]
      }
      deps +=
          [ "//components/crash/core/app:chrome_crashpad_handler_named_as_so" ]
    }
  }
}