chromium/components/stability_report/BUILD.gn

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

import("//third_party/protobuf/proto_library.gni")

if (is_win || is_linux || is_chromeos || is_mac) {
  proto_library("stability_report_proto") {
    sources = [ "stability_report.proto" ]
  }

  # This target links into the crashpad handler which lives in chrome_elf.dll
  # on Windows.
  static_library("stability_report") {
    sources = [
      "stability_report_data_source.cc",
      "stability_report_data_source.h",
      "user_stream_data_source.cc",
      "user_stream_data_source.h",
    ]

    deps = [
      ":stability_report_proto",
      "//base",
      "//third_party/crashpad/crashpad/handler",
      "//third_party/crashpad/crashpad/minidump",
      "//third_party/crashpad/crashpad/snapshot",
    ]

    if (is_win) {
      sources += [
        "user_stream_data_source_win.cc",
        "user_stream_data_source_win.h",
      ]
    }

    if (is_linux || is_chromeos || is_mac) {
      sources += [
        "user_stream_data_source_posix.cc",
        "user_stream_data_source_posix.h",
      ]
    }
  }

  source_set("unit_tests") {
    testonly = true

    sources = [
      "test/stability_report_reader.cc",
      "test/stability_report_reader.h",
    ]

    deps = [
      ":stability_report",
      ":stability_report_proto",
      "//base",
      "//testing/gtest",
      "//third_party/crashpad/crashpad/minidump",
      "//third_party/crashpad/crashpad/snapshot:test_support",
    ]

    if (is_win) {
      sources += [ "user_stream_data_source_win_unittest.cc" ]
    }

    if (is_linux || is_chromeos || is_mac) {
      sources += [ "user_stream_data_source_posix_unittest.cc" ]

      deps += [ "//base/test:test_support" ]
    }
  }
}