| # Copyright 2018 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/pkg_config.gni") |
| import("//common-mk/proto_library.gni") |
| |
| group("all") { |
| deps = [ |
| ":anomaly_detector", |
| ":crash_reporter", |
| ":crash_sender", |
| ":crash_serializer_main", |
| ":libcrash", |
| ":libcrash_reporter", |
| ] |
| if (use.cheets) { |
| deps += [ ":core_collector" ] |
| } |
| if (use.test) { |
| deps += [ |
| ":anomaly_detector_log_reader_test", |
| ":anomaly_detector_test", |
| ":anomaly_detector_text_file_reader_test", |
| ":crash_reporter_test", |
| ] |
| } |
| if (use.fuzzer) { |
| deps += [ |
| ":anomaly_detector_fuzzer", |
| ":chrome_collector_fuzzer", |
| ":crash_sender_fuzzer", |
| ] |
| } |
| } |
| |
| pkg_config("libcrash_config") { |
| pkg_deps = [ |
| "libchrome", |
| "libsession_manager-client", |
| "re2", |
| "vboot_host", |
| "zlib", |
| ] |
| } |
| |
| static_library("libcrash") { |
| all_dependent_configs = [ ":libcrash_config" ] |
| sources = [ |
| "paths.cc", |
| "util.cc", |
| ] |
| |
| defines = [ "USE_DIRENCRYPTION=${use.direncryption}" ] |
| |
| if (use.direncryption) { |
| libs = [ "keyutils" ] |
| } |
| } |
| |
| pkg_config("libcrash_reporter_config") { |
| pkg_deps = [ |
| "libbrillo", |
| "libchrome", |
| "libdebugd-client", |
| "libpcrecpp", |
| "libsession_manager-client", |
| ] |
| } |
| |
| static_library("libcrash_reporter") { |
| all_dependent_configs = [ ":libcrash_reporter_config" ] |
| sources = [ |
| "bert_collector.cc", |
| "chrome_collector.cc", |
| "crash_collector.cc", |
| "crash_reporter_failure_collector.cc", |
| "ec_collector.cc", |
| "ephemeral_crash_collector.cc", |
| "generic_failure_collector.cc", |
| "kernel_collector.cc", |
| "kernel_warning_collector.cc", |
| "missed_crash_collector.cc", |
| "mount_failure_collector.cc", |
| "selinux_violation_collector.cc", |
| "udev_collector.cc", |
| "unclean_shutdown_collector.cc", |
| "user_collector.cc", |
| "user_collector_base.cc", |
| "vm_collector.cc", |
| "vm_support.cc", |
| ] |
| defines = [ |
| "USE_DIRENCRYPTION=${use.direncryption}", |
| "USE_KVM_GUEST=${use.kvm_guest}", |
| ] |
| |
| if (use.cheets) { |
| sources += [ |
| "arc_collector.cc", |
| "arc_util.cc", |
| "arcvm_kernel_collector.cc", |
| "arcvm_native_collector.cc", |
| ] |
| } |
| |
| if (use.kvm_guest) { |
| sources += [ "vm_support_proper.cc" ] |
| } |
| } |
| |
| pkg_config("crash_reporter_config") { |
| pkg_deps = [ |
| "dbus-1", |
| "libmetrics", |
| "libminijail", |
| "protobuf", |
| "vm_protos", |
| ] |
| |
| if (use.kvm_guest) { |
| pkg_deps += [ "grpc++" ] |
| } |
| } |
| |
| executable("crash_reporter") { |
| configs += [ ":crash_reporter_config" ] |
| sources = [ "crash_reporter.cc" ] |
| defines = [ |
| "USE_CHEETS=${use.cheets}", |
| "USE_KVM_GUEST=${use.kvm_guest}", |
| ] |
| deps = [ |
| ":libcrash", |
| ":libcrash_reporter", |
| ] |
| } |
| |
| pkg_config("libcrash_sender_config") { |
| pkg_deps = [ |
| "libbrillo", |
| "libchrome", |
| "libmetrics", |
| "libminijail", |
| "libsession_manager-client", |
| "libshill-client", |
| ] |
| if (use.fuzzer) { |
| pkg_deps += [ "protobuf" ] |
| } else { |
| pkg_deps += [ "protobuf-lite" ] |
| } |
| } |
| |
| proto_library("crash_sender_proto") { |
| proto_in_dir = "./proto" |
| proto_out_dir = "include/crash-reporter" |
| sources = [ "${proto_in_dir}/crash_sender.proto" ] |
| } |
| |
| static_library("libcrash_sender") { |
| all_dependent_configs = [ ":libcrash_sender_config" ] |
| sources = [ |
| "crash_sender_base.cc", |
| "crash_sender_util.cc", |
| ] |
| defines = [ "USE_CHROMELESS_TTY=${use.chromeless_tty}" ] |
| deps = [ ":crash_sender_proto" ] |
| } |
| |
| executable("crash_sender") { |
| sources = [ "crash_sender.cc" ] |
| deps = [ |
| ":libcrash", |
| ":libcrash_sender", |
| ] |
| } |
| |
| pkg_config("crash_serializer_config") { |
| pkg_deps = [ |
| "libbrillo", |
| "libchrome", |
| "libsession_manager-client", |
| "protobuf", |
| ] |
| } |
| |
| static_library("libcrash_serializer") { |
| all_dependent_configs = [ ":crash_serializer_config" ] |
| sources = [ "crash_serializer.cc" ] |
| deps = [ |
| ":crash_serializer_proto", |
| ":libcrash", |
| ":libcrash_sender", |
| ] |
| } |
| |
| executable("crash_serializer_main") { |
| output_name = "crash_serializer" |
| sources = [ "crash_serializer_main.cc" ] |
| deps = [ |
| ":libcrash", |
| ":libcrash_sender", |
| ":libcrash_serializer", |
| ] |
| } |
| |
| proto_library("crash_serializer_proto") { |
| proto_in_dir = "./proto" |
| proto_out_dir = "include/crash-reporter" |
| sources = [ "${proto_in_dir}/crash_serializer.proto" ] |
| } |
| |
| pkg_config("anomaly_detector_config") { |
| # NOSORT |
| pkg_deps = [ |
| "libbrillo", |
| "libchrome", |
| "libmetrics", |
| "re2", |
| |
| # system_api depends on protobuf. It must appear before protobuf |
| # here or the linker flags won't be in the right order. |
| "system_api", |
| "vm_protos", |
| |
| "protobuf", |
| ] |
| } |
| |
| executable("anomaly_detector") { |
| configs += [ ":anomaly_detector_config" ] |
| sources = [ |
| "anomaly_detector.cc", |
| "anomaly_detector_log_reader.cc", |
| "anomaly_detector_main.cc", |
| "anomaly_detector_service.cc", |
| "anomaly_detector_text_file_reader.cc", |
| "crash_reporter_parser.cc", |
| ] |
| deps = [ ":libcrash" ] |
| libs = [ |
| "system_api-metrics_event-protos", |
| "system_api-anomaly_detector-protos", |
| ] |
| } |
| |
| if (use.cheets) { |
| pkg_config("core_collector_config") { |
| pkg_deps = [ "breakpad-client" ] |
| } |
| |
| executable("core_collector") { |
| configs += [ ":core_collector_config" ] |
| sources = [ |
| "core-collector/core_collector.cc", |
| "core-collector/coredump_writer.cc", |
| "core-collector/coredump_writer.h", |
| ] |
| |
| # This condition matches the "use_i686" helper in the "cros-i686" |
| # eclass. The "amd64" check allows the "cros_i686" USE flag to be |
| # enabled for an overlay inherited by non-x86 boards. |
| if (use.cros_i686 && use.amd64) { |
| # We link the C & C++ runtime statically because dynamic libs for these |
| # (multilib) ABIs aren't installed. The eclasses handle forcing -static, |
| # and that doesn't work with PIE linking |
| configs -= [ "//common-mk:pie" ] |
| } |
| |
| # This condition matches the "use_arm64" helper in the "cros-arm64" |
| # eclass. The "arm" check allows the "cros_arm64" USE flag to be |
| # enabled for an overlay inherited by non-arm boards. |
| if (use.cros_arm64 && use.arm) { |
| # We link the C & C++ runtime statically because dynamic libs for these |
| # (multilib) ABIs aren't installed. The eclasses handle forcing -static, |
| # and that doesn't work with PIE linking |
| configs -= [ "//common-mk:pie" ] |
| } |
| } |
| } |
| |
| if (use.test || use.fuzzer) { |
| pkg_config("crash_reporter_test_config") { |
| pkg_deps = [ |
| "libchrome-test", |
| "libdebugd-client-test", |
| "libmetrics", |
| "libsession_manager-client-test", |
| "libshill-client-test", |
| "protobuf", |
| "vm_protos", |
| ] |
| |
| if (use.kvm_guest) { |
| pkg_deps += [ "grpc++" ] |
| } |
| } |
| |
| static_library("libcrash_test_util") { |
| all_dependent_configs = [ |
| ":crash_reporter_test_config", |
| ":libcrash_config", |
| ] |
| configs += [ |
| "//common-mk:test", |
| ":libcrash_reporter_config", |
| ] |
| sources = [ "test_util.cc" ] |
| } |
| } |
| |
| if (use.test) { |
| pkg_config("test_helper_config") { |
| pkg_deps = [ |
| "libbrillo", |
| "libchrome", |
| "libchrome-test", |
| ] |
| } |
| |
| executable("lock_file_tester") { |
| configs += [ |
| "//common-mk:test", |
| ":test_helper_config", |
| ] |
| sources = [ "lock_file_tester.cc" ] |
| } |
| |
| executable("hold_lock_file") { |
| configs += [ |
| "//common-mk:test", |
| ":test_helper_config", |
| ] |
| sources = [ "hold_lock_file.cc" ] |
| } |
| |
| executable("crash_reporter_test") { |
| configs += [ |
| "//common-mk:test", |
| ":crash_reporter_test_config", |
| ] |
| sources = [ |
| "bert_collector_test.cc", |
| "chrome_collector_test.cc", |
| "crash_collector_test.cc", |
| "crash_collector_test.h", |
| "crash_reporter_failure_collector_test.cc", |
| "crash_reporter_logs_test.cc", |
| "crash_sender_base_test.cc", |
| "crash_sender_util_test.cc", |
| "crash_serializer_test.cc", |
| "ec_collector_test.cc", |
| "ephemeral_crash_collector_test.cc", |
| "generic_failure_collector_test.cc", |
| "kernel_collector_test.cc", |
| "kernel_collector_test.h", |
| "kernel_warning_collector_test.cc", |
| "missed_crash_collector_test.cc", |
| "mount_failure_collector_test.cc", |
| "paths_test.cc", |
| "selinux_violation_collector_test.cc", |
| "testrunner.cc", |
| "udev_collector_test.cc", |
| "unclean_shutdown_collector_test.cc", |
| "user_collector_test.cc", |
| "util_test.cc", |
| ] |
| defines = [ |
| "USE_KVM_GUEST=${use.kvm_guest}", |
| "USE_CHROMELESS_TTY=${use.chromeless_tty}", |
| ] |
| deps = [ |
| ":crash_serializer_proto", |
| ":hold_lock_file", |
| ":libcrash", |
| ":libcrash_reporter", |
| ":libcrash_sender", |
| ":libcrash_serializer", |
| ":libcrash_test_util", |
| ":lock_file_tester", |
| ] |
| |
| if (use.cheets) { |
| sources += [ |
| "arc_collector_test.cc", |
| "arc_util_test.cc", |
| "arcvm_kernel_collector_test.cc", |
| "arcvm_native_collector_test.cc", |
| ] |
| } |
| } |
| |
| executable("anomaly_detector_test") { |
| configs += [ |
| "//common-mk:test", |
| ":anomaly_detector_config", |
| ":crash_reporter_test_config", |
| ] |
| sources = [ |
| "anomaly_detector.cc", |
| "anomaly_detector_test.cc", |
| "anomaly_detector_test_utils.cc", |
| "crash_reporter_parser.cc", |
| "crash_reporter_parser_test.cc", |
| "test_util.cc", |
| ] |
| deps = [ |
| ":libcrash", |
| "//common-mk/testrunner:testrunner", |
| ] |
| libs = [ "system_api-anomaly_detector-protos" ] |
| } |
| |
| executable("anomaly_detector_text_file_reader_test") { |
| configs += [ |
| "//common-mk:test", |
| ":anomaly_detector_config", |
| ":crash_reporter_test_config", |
| ] |
| sources = [ |
| "anomaly_detector_text_file_reader.cc", |
| "anomaly_detector_text_file_reader_test.cc", |
| "test_util.cc", |
| ] |
| deps = [ |
| ":libcrash", |
| "//common-mk/testrunner:testrunner", |
| ] |
| libs = [ "system_api-anomaly_detector-protos" ] |
| } |
| |
| executable("anomaly_detector_log_reader_test") { |
| configs += [ |
| "//common-mk:test", |
| ":anomaly_detector_config", |
| ":crash_reporter_test_config", |
| ] |
| sources = [ |
| "anomaly_detector_log_reader.cc", |
| "anomaly_detector_log_reader_test.cc", |
| "anomaly_detector_text_file_reader.cc", |
| "test_util.cc", |
| ] |
| deps = [ |
| ":libcrash", |
| "//common-mk/testrunner:testrunner", |
| ] |
| libs = [ "system_api-anomaly_detector-protos" ] |
| } |
| } |
| |
| if (use.fuzzer) { |
| executable("crash_sender_fuzzer") { |
| configs += [ "//common-mk/common_fuzzer:common_fuzzer" ] |
| deps = [ |
| ":libcrash", |
| ":libcrash_sender", |
| ":libcrash_test_util", |
| ] |
| sources = [ "crash_sender_fuzzer.cc" ] |
| } |
| |
| executable("chrome_collector_fuzzer") { |
| configs += [ |
| "//common-mk/common_fuzzer:common_fuzzer", |
| ":crash_reporter_test_config", |
| ] |
| deps = [ |
| ":libcrash", |
| ":libcrash_reporter", |
| ":libcrash_test_util", |
| ] |
| sources = [ "chrome_collector_fuzzer.cc" ] |
| } |
| |
| executable("anomaly_detector_fuzzer") { |
| configs += [ |
| "//common-mk/common_fuzzer:common_fuzzer", |
| ":anomaly_detector_config", |
| ] |
| deps = [ |
| ":libcrash", |
| ":libcrash_test_util", |
| ] |
| sources = [ |
| "anomaly_detector.cc", |
| "anomaly_detector_fuzzer.cc", |
| "crash_reporter_parser.cc", |
| ] |
| libs = [ "system_api-anomaly_detector-protos" ] |
| } |
| } |