blob: 9af0e2f254fda3af4eec99cd27150544346428c2 [file] [log] [blame]
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config.gni")
import("//build/package.gni")
###############################################################################
# PACKAGES
###############################################################################
# We use a template to keep the real and fake packages in sync.
template("crash_reports_package") {
package(target_name) {
binaries = [
{
name = "crash_reports"
},
]
meta = [
{
path = "meta/crash_reports.cmx"
dest = "crash_reports.cmx"
},
]
resources = [
{
path = "configs/default.json"
dest = "default_config.json"
},
]
deps = [ ":main" ]
}
# Suppress unused variable warnings as the invoker is expected to be empty.
not_needed(invoker, "*")
}
# The real package.
crash_reports_package("crash-reports") {
}
# A fake package for integration test purposes to make sure any config_data() for the real
# package does not impact the component used in the integration test.
crash_reports_package("fake-crash-reports") {
}
# A fake package for integration test purposes where we want a valid override config_data() that
# only affects the fake package.
crash_reports_package("fake-crash-reports-valid-override-config") {
}
# A fake package for integration test purposes where we want an invalid override config_data() that
# only affects the fake package.
crash_reports_package("fake-crash-reports-invalid-override-config") {
}
###############################################################################
# EXECUTABLES
###############################################################################
executable("main") {
output_name = "crash_reports"
sources = [ "main.cc" ]
deps = [
":main_service",
"//sdk/fidl/fuchsia.feedback",
"//sdk/lib/sys/cpp",
"//src/developer/feedback/crash_reports/info",
"//src/lib/syslog/cpp",
"//src/lib/timekeeper:system",
"//zircon/public/lib/async-loop-cpp",
"//zircon/public/lib/async-loop-default",
]
}
###############################################################################
# SOURCES
###############################################################################
source_set("main_service") {
sources = [
"main_service.cc",
"main_service.h",
]
public_deps = [
":config",
":crash_reporter",
"//sdk/fidl/fuchsia.feedback",
"//sdk/lib/fidl/cpp",
"//sdk/lib/sys/cpp",
"//src/developer/feedback/crash_reports/info",
"//src/lib/fxl",
"//src/lib/timekeeper",
"//zircon/public/lib/async",
]
deps = [
"//src/lib/files",
"//src/lib/syslog/cpp",
"//zircon/public/lib/zx",
]
}
source_set("config") {
public = [ "config.h" ]
sources = [
"config.cc",
"config.h",
]
deps = [
":constants",
"//src/lib/files",
"//src/lib/syslog/cpp",
"//third_party/rapidjson",
]
}
source_set("constants") {
sources = [ "constants.h" ]
visibility = [ "//src/developer/feedback/crash_reports/*" ]
}
source_set("crash_reporter") {
sources = [
"crash_reporter.cc",
"crash_reporter.h",
]
public_deps = [
":crash_server",
":privacy_settings_ptr",
":queue",
":settings",
"//sdk/fidl/fuchsia.feedback",
"//sdk/lib/sys/cpp",
"//src/developer/feedback/crash_reports/info",
"//src/developer/feedback/utils:utc_time_provider",
"//src/developer/feedback/utils/fidl:channel_provider_ptr",
"//src/developer/feedback/utils/fidl:data_provider_ptr",
"//src/developer/feedback/utils/fidl:device_id_provider_ptr",
"//src/developer/feedback/utils/fit",
"//src/lib/timekeeper",
"//zircon/public/lib/async",
"//zircon/public/lib/async-cpp",
]
deps = [
":report_util",
"//src/developer/feedback/utils/cobalt",
"//src/lib/syslog/cpp",
]
}
source_set("crash_server") {
sources = [
"crash_server.cc",
"crash_server.h",
]
public_deps = [
"//src/lib/fxl",
"//third_party/crashpad/third_party/mini_chromium/mini_chromium/base",
"//third_party/crashpad/util",
]
}
source_set("database") {
public = [ "database.h" ]
sources = [
"database.cc",
"database.h",
"upload_report.cc",
"upload_report.h",
]
public_deps = [
"//src/developer/feedback/crash_reports/info",
"//src/developer/feedback/utils/cobalt",
"//src/lib/fxl",
"//third_party/crashpad/client",
"//third_party/crashpad/util",
"//zircon/system/fidl/fuchsia-mem",
]
deps = [
":constants",
":report_util",
"//src/lib/files",
"//src/lib/syslog/cpp",
]
}
source_set("privacy_settings_ptr") {
sources = [
"privacy_settings_ptr.cc",
"privacy_settings_ptr.h",
]
public_deps = [
":settings",
"//sdk/fidl/fuchsia.feedback",
"//sdk/fidl/fuchsia.settings",
"//sdk/lib/sys/cpp",
"//src/lib/backoff",
"//src/lib/fxl",
"//zircon/public/lib/async",
"//zircon/public/lib/zx",
]
deps = [
"//garnet/public/lib/fostr/fidl/fuchsia.settings",
"//src/lib/syslog/cpp",
"//zircon/public/lib/async-cpp",
"//zircon/public/lib/fit",
]
}
source_set("queue") {
sources = [
"queue.cc",
"queue.h",
]
public_deps = [
":crash_server",
":database",
":settings",
"//src/developer/feedback/crash_reports/info",
"//src/lib/backoff",
"//src/lib/fxl",
"//third_party/crashpad/util",
"//zircon/public/lib/async",
"//zircon/system/fidl/fuchsia-net",
]
deps = [
"//src/lib/syslog/cpp",
"//zircon/public/lib/async-cpp",
]
}
source_set("report_util") {
sources = [
"report_util.cc",
"report_util.h",
]
public_deps = [
"//sdk/fidl/fuchsia.feedback",
"//third_party/crashpad/client",
"//third_party/crashpad/util",
"//zircon/system/fidl/fuchsia-mem",
]
deps = [
"//src/lib/files",
"//src/lib/fxl",
"//src/lib/syslog/cpp",
]
}
source_set("settings") {
public = [ "settings.h" ]
sources = [
"settings.cc",
"settings.h",
]
public_deps = [
":config",
"//src/lib/fxl",
"//zircon/public/lib/fit",
]
deps = [ "//src/lib/syslog/cpp" ]
}
###############################################################################
# CONFIGS
###############################################################################
config_data("production_config") {
for_pkg = "crash-reports"
sources = [ "configs/production.json" ]
outputs = [ "override_config.json" ]
}
config_data("upload_to_prod_server_config") {
for_pkg = "crash-reports"
sources = [ "configs/upload_to_prod_server.json" ]
outputs = [ "override_config.json" ]
}