blob: 43095bce9280450ba886a2206e368f96c74394f7 [file] [log] [blame]
# Copyright 2019 The Chromium OS 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("//common-mk/mojom_bindings_generator.gni")
import("//common-mk/pkg_config.gni")
group("all") {
deps = [
":cros_healthd",
":telem",
":wilco_dtc_supportd",
"//diagnostics/cros_healthd_event_tool:cros-health-event",
"//diagnostics/diag:diag",
"//diagnostics/routines:floating-point-accuracy",
"//diagnostics/routines:prime-search",
"//diagnostics/routines:smartctl-check",
"//diagnostics/routines:urandom",
]
if (use.test) {
deps += [
":cros_healthd_test",
":libcros_healthd_utils_test",
":wilco_dtc_supportd_test",
"//diagnostics/common:libcommon_test",
"//diagnostics/cros_healthd/events:libcros_healthd_events_test",
"//diagnostics/cros_healthd_mojo_adapter:cros_healthd_mojo_adapter_test",
"//diagnostics/grpc_async_adapter:libgrpc_async_adapter_test",
"//diagnostics/routines:routine_test",
]
}
if (use.fuzzer) {
deps += [
":fetch_block_device_fuzzer",
":fetch_cached_vpd_fuzzer",
]
}
}
# Library with generated Mojo API definitions.
pkg_config("diagnostics_mojo_bindings_pkg_deps") {
pkg_deps = [
"libchrome-${libbase_ver}",
"libmojo-${libbase_ver}",
]
}
generate_mojom_bindings("diagnostics_mojo_bindings") {
public_configs = [ ":diagnostics_mojo_bindings_pkg_deps" ]
sources = [
"mojo/cros_healthd.mojom",
"mojo/cros_healthd_diagnostics.mojom",
"mojo/cros_healthd_events.mojom",
"mojo/cros_healthd_probe.mojom",
"mojo/wilco_dtc_supportd.mojom",
]
use_once_callback = true
}
# Library that provides utilities used by cros_healthd.
pkg_config("libcros_healthd_utils_pkg_deps") {
pkg_deps = [
"dbus-1",
"libbrillo",
"libchrome-${libbase_ver}",
"libcros_config",
"libmojo-${libbase_ver}",
"libdebugd-client",
"libudev",
"protobuf",
"re2",
"system_api",
]
}
source_set("libcros_healthd_utils") {
deps = [
":diagnostics_mojo_bindings",
"//diagnostics/common:libcommon",
]
all_dependent_configs = [ ":libcros_healthd_utils_pkg_deps" ]
sources = [
"cros_healthd/utils/backlight_utils.cc",
"cros_healthd/utils/battery_utils.cc",
"cros_healthd/utils/cpu_utils.cc",
"cros_healthd/utils/disk_utils.cc",
"cros_healthd/utils/fan_utils.cc",
"cros_healthd/utils/memory_utils.cc",
"cros_healthd/utils/timezone_utils.cc",
"cros_healthd/utils/vpd_utils.cc",
]
}
# Library that provides core functionality for the cros_healthd daemon.
pkg_config("libcros_healthd_pkg_deps") {
pkg_deps = [
"dbus-1",
"libbrillo",
"libchrome-${libbase_ver}",
"libmojo-${libbase_ver}",
"libdebugd-client",
]
}
source_set("libcros_healthd") {
deps = [
":diagnostics_mojo_bindings",
":libcros_healthd_utils",
"//diagnostics/cros_healthd/events:libcros_healthd_events",
"//diagnostics/routines:libdiag_routine",
]
all_dependent_configs = [ ":libcros_healthd_pkg_deps" ]
sources = [
"cros_healthd/cros_healthd.cc",
"cros_healthd/cros_healthd_mojo_service.cc",
"cros_healthd/cros_healthd_routine_factory_impl.cc",
"cros_healthd/cros_healthd_routine_service_impl.cc",
]
}
# Library that provides core functionality for the wilco_dtc_supportd daemon.
pkg_config("libwilco_dtc_supportd_pkg_deps") {
pkg_deps = [
"dbus-1",
"libbrillo",
"libchrome-${libbase_ver}",
"libmojo-${libbase_ver}",
"system_api",
]
}
source_set("libwilco_dtc_supportd") {
deps = [
":diagnostics_mojo_bindings",
"//diagnostics/common:libcommon",
"//diagnostics/constants:libconstants",
"//diagnostics/grpc:wilco_dtc_grpc_protos",
"//diagnostics/grpc_async_adapter:libgrpc_async_adapter",
"//diagnostics/routines:libdiag_routine",
]
all_dependent_configs = [ ":libwilco_dtc_supportd_pkg_deps" ]
sources = [
"wilco_dtc_supportd/core.cc",
"wilco_dtc_supportd/core_delegate_impl.cc",
"wilco_dtc_supportd/daemon.cc",
"wilco_dtc_supportd/dbus_service.cc",
"wilco_dtc_supportd/ec_constants.cc",
"wilco_dtc_supportd/grpc_service.cc",
"wilco_dtc_supportd/json_utils.cc",
"wilco_dtc_supportd/mojo_service.cc",
"wilco_dtc_supportd/routine_service.cc",
"wilco_dtc_supportd/telemetry/bluetooth_event_service.cc",
"wilco_dtc_supportd/telemetry/bluetooth_event_service_impl.cc",
"wilco_dtc_supportd/telemetry/ec_event_service.cc",
"wilco_dtc_supportd/telemetry/powerd_event_service_impl.cc",
"wilco_dtc_supportd/telemetry/system_files_service.cc",
"wilco_dtc_supportd/telemetry/system_files_service_impl.cc",
"wilco_dtc_supportd/telemetry/system_info_service_impl.cc",
]
}
# The cros_healthd daemon executable.
pkg_config("cros_healthd_pkg_deps") {
pkg_deps = [ "libbrillo" ]
}
executable("cros_healthd") {
deps = [
":libcros_healthd",
]
sources = [
"cros_healthd/main.cc",
]
}
# The wilco_dtc_supportd daemon executable.
pkg_config("wilco_dtc_supportd_pkg_deps") {
pkg_deps = [ "libbrillo" ]
}
executable("wilco_dtc_supportd") {
deps = [
":libwilco_dtc_supportd",
]
sources = [
"wilco_dtc_supportd/main.cc",
]
}
# The telemetry tool executable.
pkg_config("telem_pkg_deps") {
pkg_deps = [
"libbrillo",
"libchrome-${libbase_ver}",
]
}
executable("telem") {
deps = [
"//diagnostics/cros_healthd_mojo_adapter:libcros_healthd_mojo_adapter",
]
configs += [ ":telem_pkg_deps" ]
sources = [
"telem/main.cc",
]
}
if (use.test) {
# Libraries for unit tests.
# Unit tests.
pkg_config("cros_healthd_test_pkg_deps") {
pkg_deps = [
"libchrome-${libbase_ver}",
"libchrome-test-${libbase_ver}",
"libdebugd-client-test",
]
}
executable("cros_healthd_test") {
configs += [
":cros_healthd_test_pkg_deps",
"//common-mk:test",
]
deps = [
":libcros_healthd",
"../common-mk/testrunner:testrunner",
"//diagnostics/common:libcommon_test_utils",
"//diagnostics/routines:libroutine_test_utils",
]
sources = [
"cros_healthd/cros_healthd_mojo_service_test.cc",
"cros_healthd/cros_healthd_routine_service_impl_test.cc",
"cros_healthd/fake_cros_healthd_routine_factory.cc",
]
}
pkg_config("libcros_healthd_utils_test_pkg_deps") {
pkg_deps = [
"libchrome-${libbase_ver}",
"libchrome-test-${libbase_ver}",
"libcros_config",
"libdebugd-client-test",
"system_api",
]
}
executable("libcros_healthd_utils_test") {
configs += [
":libcros_healthd_utils_test_pkg_deps",
"//common-mk:test",
]
deps = [
":libcros_healthd_utils",
"../common-mk/testrunner:testrunner",
"//diagnostics/common:libcommon_test_utils",
]
sources = [
"cros_healthd/utils/backlight_utils_test.cc",
"cros_healthd/utils/battery_utils_test.cc",
"cros_healthd/utils/cpu_utils_test.cc",
"cros_healthd/utils/fan_utils_test.cc",
"cros_healthd/utils/memory_utils_test.cc",
"cros_healthd/utils/timezone_utils_test.cc",
"cros_healthd/utils/vpd_utils_test.cc",
]
}
pkg_config("wilco_dtc_supportd_test_pkg_deps") {
pkg_deps = [
"libchrome-${libbase_ver}",
"libchrome-test-${libbase_ver}",
]
}
executable("wilco_dtc_supportd_test") {
configs += [
":wilco_dtc_supportd_test_pkg_deps",
"//common-mk:test",
]
deps = [
":libwilco_dtc_supportd",
"../common-mk/testrunner:testrunner",
"//diagnostics/common:libcommon",
"//diagnostics/common:libcommon_test_utils",
]
sources = [
"wilco_dtc_supportd/core_test.cc",
"wilco_dtc_supportd/dbus_service_test.cc",
"wilco_dtc_supportd/ec_constants_test.cc",
"wilco_dtc_supportd/fake_browser.cc",
"wilco_dtc_supportd/fake_diagnostics_service.cc",
"wilco_dtc_supportd/fake_wilco_dtc.cc",
"wilco_dtc_supportd/grpc_service_test.cc",
"wilco_dtc_supportd/mock_mojo_client.cc",
"wilco_dtc_supportd/mojo_service_test.cc",
"wilco_dtc_supportd/routine_service_test.cc",
"wilco_dtc_supportd/telemetry/bluetooth_event_service_impl_test.cc",
"wilco_dtc_supportd/telemetry/ec_event_service_test.cc",
"wilco_dtc_supportd/telemetry/ec_event_test_utils.cc",
"wilco_dtc_supportd/telemetry/ec_event_test_utils_test.cc",
"wilco_dtc_supportd/telemetry/fake_bluetooth_event_service.cc",
"wilco_dtc_supportd/telemetry/fake_ec_event_service.cc",
"wilco_dtc_supportd/telemetry/fake_powerd_event_service.cc",
"wilco_dtc_supportd/telemetry/mock_system_files_service.cc",
"wilco_dtc_supportd/telemetry/mock_system_info_service.cc",
"wilco_dtc_supportd/telemetry/powerd_event_service_impl_test.cc",
"wilco_dtc_supportd/telemetry/system_files_service_impl_test.cc",
"wilco_dtc_supportd/telemetry/system_info_service_impl_test.cc",
]
}
}
if (use.fuzzer) {
executable("fetch_block_device_fuzzer") {
configs += [ "//common-mk/common_fuzzer:common_fuzzer" ]
deps = [
":libcros_healthd_utils",
]
sources = [
"cros_healthd/utils/fetch_block_device_fuzzer.cc",
]
}
pkg_config("fetch_cached_vpd_fuzzer_pkg_deps") {
pkg_deps = [ "libcros_config" ]
}
executable("fetch_cached_vpd_fuzzer") {
configs += [
":fetch_cached_vpd_fuzzer_pkg_deps",
"//common-mk/common_fuzzer:common_fuzzer",
]
deps = [
":libcros_healthd_utils",
]
sources = [
"cros_healthd/utils/fetch_cached_vpd_fuzzer.cc",
]
}
}