| # 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") |
| import("//common-mk/proto_library.gni") |
| |
| group("all") { |
| deps = [ |
| ":diag", |
| ":diagnostics_dpsl_demo_single_thread", |
| ":telem", |
| ":urandom", |
| ":wilco_dtc", |
| ":wilco_dtc_supportd", |
| ] |
| if (use.test) { |
| deps += [ |
| ":libdiag_test", |
| ":libgrpc_async_adapter_test", |
| ":libtelem_test", |
| ":routine_test", |
| ":wilco_dtc_supportd_test", |
| ] |
| } |
| } |
| |
| # Library with generated gRPC API definitions. |
| pkg_config("diagnostics_grpc_protos_exported_pkg_deps") { |
| pkg_deps = [ |
| "grpc++", |
| "protobuf", |
| ] |
| } |
| |
| proto_library("diagnostics_grpc_protos") { |
| proto_in_dir = "grpc" |
| proto_out_dir = "include" |
| gen_grpc = true |
| all_dependent_configs = [ ":diagnostics_grpc_protos_exported_pkg_deps" ] |
| sources = [ |
| "${proto_in_dir}/diagnostics_processor.proto", |
| "${proto_in_dir}/diagnosticsd.proto", |
| ] |
| |
| # libdiagnostics_grpc_protos.a is used by a shared_library object, so we need |
| # to build it with '-fPIC' instead of '-fPIE'. |
| use_pic = true |
| } |
| |
| # Library that adopts gRPC core async interface to a libchrome-friendly one. |
| pkg_config("libgrpc_async_adapter_exported_pkg_deps") { |
| pkg_deps = [ |
| "grpc++", |
| "libchrome-${libbase_ver}", |
| ] |
| } |
| |
| static_library("libgrpc_async_adapter") { |
| all_dependent_configs = [ ":libgrpc_async_adapter_exported_pkg_deps" ] |
| libs = [ "gpr" ] |
| sources = [ |
| "grpc_async_adapter/async_grpc_client.cc", |
| "grpc_async_adapter/async_grpc_server.cc", |
| "grpc_async_adapter/grpc_completion_queue_dispatcher.cc", |
| "grpc_async_adapter/rpc_state.cc", |
| ] |
| |
| # libgrpc_async_adapter.a is used by a shared_library object, so we need to |
| # build it with '-fPIC' instead of '-fPIE'. |
| configs -= [ "//common-mk:pie" ] |
| configs += [ "//common-mk:pic" ] |
| } |
| |
| # 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/diagnosticsd.mojom", |
| ] |
| } |
| |
| # Library that provides the diagnostic routine interface. |
| pkg_config("libdiag_routine_pkg_deps") { |
| pkg_deps = [ "libchrome-${libbase_ver}" ] |
| } |
| |
| static_library("libdiag_routine") { |
| deps = [ |
| ":diagnostics_grpc_protos", |
| ] |
| all_dependent_configs = [ ":libdiag_routine_pkg_deps" ] |
| sources = [ |
| "routines/battery/battery.cc", |
| "routines/diag_process_adapter_impl.cc", |
| "routines/urandom/urandom.cc", |
| ] |
| } |
| |
| # Library that provides core functionality for the diag tool. |
| pkg_config("libdiag_pkg_deps") { |
| pkg_deps = [ |
| "libbrillo-${libbase_ver}", |
| "libchrome-${libbase_ver}", |
| ] |
| } |
| |
| static_library("libdiag") { |
| deps = [ |
| ":diagnostics_grpc_protos", |
| ":libconstants", |
| ":libgrpc_async_adapter", |
| ] |
| all_dependent_configs = [ ":libdiag_pkg_deps" ] |
| sources = [ |
| "diag/diag_async_grpc_client_adapter_impl.cc", |
| "diag/diag_routine_requester.cc", |
| ] |
| } |
| |
| static_library("libconstants") { |
| sources = [ |
| "constants/grpc_constants.cc", |
| ] |
| } |
| |
| # Library that provides core functionality for the wilco_dtc_supportd daemon. |
| pkg_config("libwilco_dtc_supportd_pkg_deps") { |
| pkg_deps = [ |
| "dbus-1", |
| "libbrillo-${libbase_ver}", |
| "libchrome-${libbase_ver}", |
| "libmojo-${libbase_ver}", |
| "system_api", |
| ] |
| } |
| |
| static_library("libwilco_dtc_supportd") { |
| deps = [ |
| ":diagnostics_grpc_protos", |
| ":diagnostics_mojo_bindings", |
| ":libconstants", |
| ":libdiag_routine", |
| ":libgrpc_async_adapter", |
| ] |
| all_dependent_configs = [ ":libwilco_dtc_supportd_pkg_deps" ] |
| sources = [ |
| "wilco_dtc_supportd/ec_constants.cc", |
| "wilco_dtc_supportd/json_utils.cc", |
| "wilco_dtc_supportd/mojo_utils.cc", |
| "wilco_dtc_supportd/wilco_dtc_supportd_core.cc", |
| "wilco_dtc_supportd/wilco_dtc_supportd_core_delegate_impl.cc", |
| "wilco_dtc_supportd/wilco_dtc_supportd_daemon.cc", |
| "wilco_dtc_supportd/wilco_dtc_supportd_dbus_service.cc", |
| "wilco_dtc_supportd/wilco_dtc_supportd_ec_event_service.cc", |
| "wilco_dtc_supportd/wilco_dtc_supportd_grpc_service.cc", |
| "wilco_dtc_supportd/wilco_dtc_supportd_mojo_service.cc", |
| "wilco_dtc_supportd/wilco_dtc_supportd_routine_factory_impl.cc", |
| "wilco_dtc_supportd/wilco_dtc_supportd_routine_service.cc", |
| ] |
| } |
| |
| # Library that provides the DPSL (diagnostics processor support library) |
| # interface. |
| pkg_config("libdpsl_pkg_deps") { |
| pkg_deps = [ |
| "libbrillo-${libbase_ver}", |
| "libchrome-${libbase_ver}", |
| ] |
| } |
| |
| shared_library("libdpsl") { |
| deps = [ |
| ":diagnostics_grpc_protos", |
| ":libconstants", |
| ":libgrpc_async_adapter", |
| ] |
| configs += [ ":libdpsl_pkg_deps" ] |
| sources = [ |
| "dpsl/internal/dpsl_global_context_impl.cc", |
| "dpsl/internal/dpsl_requester_impl.cc", |
| "dpsl/internal/dpsl_rpc_server_impl.cc", |
| "dpsl/internal/dpsl_thread_context_impl.cc", |
| ] |
| } |
| |
| # Library that provides core functionality for the telemetry tool. |
| pkg_config("libtelem_pkg_deps") { |
| pkg_deps = [ |
| "libbrillo-${libbase_ver}", |
| "libchrome-${libbase_ver}", |
| "re2", |
| ] |
| } |
| |
| static_library("libtelem") { |
| deps = [ |
| ":diagnostics_grpc_protos", |
| ":libconstants", |
| ":libgrpc_async_adapter", |
| ] |
| all_dependent_configs = [ ":libtelem_pkg_deps" ] |
| sources = [ |
| "telem/async_grpc_client_adapter_impl.cc", |
| "telem/telem_cache.cc", |
| "telem/telem_connection.cc", |
| ] |
| } |
| |
| # The diag tool executable. |
| pkg_config("diag_pkg_deps") { |
| pkg_deps = [ |
| "libbrillo-${libbase_ver}", |
| "libchrome-${libbase_ver}", |
| ] |
| } |
| |
| executable("diag") { |
| deps = [ |
| ":libdiag", |
| ] |
| configs += [ ":diag_pkg_deps" ] |
| sources = [ |
| "diag/main.cc", |
| ] |
| } |
| |
| # The urandom tool executable. |
| pkg_config("urandom_pkg_deps") { |
| pkg_deps = [ |
| "libbrillo-${libbase_ver}", |
| "libchrome-${libbase_ver}", |
| ] |
| } |
| |
| executable("urandom") { |
| configs += [ ":urandom_pkg_deps" ] |
| sources = [ |
| "routines/urandom/main.cc", |
| ] |
| } |
| |
| # The wilco_dtc_supportd daemon executable. |
| pkg_config("wilco_dtc_supportd_pkg_deps") { |
| pkg_deps = [ "libbrillo-${libbase_ver}" ] |
| } |
| |
| executable("wilco_dtc_supportd") { |
| deps = [ |
| ":libwilco_dtc_supportd", |
| ] |
| sources = [ |
| "wilco_dtc_supportd/main.cc", |
| ] |
| } |
| |
| # The wilco_dtc daemon executable. |
| pkg_config("wilco_dtc_pkg_deps") { |
| pkg_deps = [ "libbrillo-${libbase_ver}" ] |
| } |
| |
| executable("wilco_dtc") { |
| configs += [ ":wilco_dtc_pkg_deps" ] |
| deps = [ |
| ":libgrpc_async_adapter", |
| ] |
| sources = [ |
| "wilco_dtc/main.cc", |
| ] |
| } |
| |
| # Executables for DPSL demos. |
| executable("diagnostics_dpsl_demo_single_thread") { |
| deps = [ |
| ":diagnostics_grpc_protos", |
| ":libdpsl", |
| ] |
| sources = [ |
| "dpsl/demo_single_thread/main.cc", |
| ] |
| } |
| |
| # The telemetry tool executable. |
| pkg_config("telem_pkg_deps") { |
| pkg_deps = [ |
| "libbrillo-${libbase_ver}", |
| "libchrome-${libbase_ver}", |
| ] |
| } |
| |
| executable("telem") { |
| deps = [ |
| ":libtelem", |
| ] |
| configs += [ ":telem_pkg_deps" ] |
| sources = [ |
| "telem/main.cc", |
| ] |
| } |
| |
| if (use.test) { |
| # Libraries for unit tests. |
| proto_library("libgrpc_async_adapter_test_rpcs_protolib") { |
| proto_in_dir = "grpc_async_adapter" |
| proto_out_dir = "include" |
| sources = [ |
| "grpc_async_adapter/test_rpcs.proto", |
| ] |
| gen_grpc = true |
| } |
| |
| pkg_config("libgrpc_async_adapter_test_rpcs_pkg_deps") { |
| pkg_deps = [ |
| "grpc++", |
| "protobuf", |
| ] |
| } |
| static_library("libgrpc_async_adapter_test_rpcs") { |
| all_dependent_configs = [ ":libgrpc_async_adapter_test_rpcs_pkg_deps" ] |
| deps = [ |
| ":libgrpc_async_adapter_test_rpcs_protolib", |
| ] |
| } |
| |
| # Unit tests. |
| pkg_config("libgrpc_async_adapter_test_pkg_deps") { |
| pkg_deps = [ |
| "libchrome-${libbase_ver}", |
| "libchrome-test-${libbase_ver}", |
| ] |
| } |
| |
| executable("libgrpc_async_adapter_test") { |
| configs += [ |
| "//common-mk:test", |
| ":libgrpc_async_adapter_test_pkg_deps", |
| ] |
| deps = [ |
| ":libgrpc_async_adapter", |
| ":libgrpc_async_adapter_test_rpcs", |
| "../common-mk/testrunner:testrunner", |
| ] |
| sources = [ |
| "grpc_async_adapter/async_grpc_client_server_test.cc", |
| "grpc_async_adapter/async_grpc_server_test.cc", |
| "grpc_async_adapter/grpc_completion_queue_dispatcher_test.cc", |
| ] |
| libs = [ "gpr" ] |
| } |
| |
| 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", |
| ] |
| sources = [ |
| "wilco_dtc_supportd/ec_constants_test.cc", |
| "wilco_dtc_supportd/fake_browser.cc", |
| "wilco_dtc_supportd/fake_wilco_dtc.cc", |
| "wilco_dtc_supportd/fake_wilco_dtc_supportd_routine_factory.cc", |
| "wilco_dtc_supportd/file_test_utils.cc", |
| "wilco_dtc_supportd/mock_mojom_wilco_dtc_supportd_client.cc", |
| "wilco_dtc_supportd/mojo_test_utils.cc", |
| "wilco_dtc_supportd/mojo_utils_test.cc", |
| "wilco_dtc_supportd/wilco_dtc_supportd_core_test.cc", |
| "wilco_dtc_supportd/wilco_dtc_supportd_dbus_service_test.cc", |
| "wilco_dtc_supportd/wilco_dtc_supportd_ec_event_service_test.cc", |
| "wilco_dtc_supportd/wilco_dtc_supportd_grpc_service_test.cc", |
| "wilco_dtc_supportd/wilco_dtc_supportd_mojo_service_test.cc", |
| "wilco_dtc_supportd/wilco_dtc_supportd_routine_service_test.cc", |
| ] |
| } |
| |
| pkg_config("libdiag_test_pkg_deps") { |
| pkg_deps = [ |
| "libchrome-${libbase_ver}", |
| "libchrome-test-${libbase_ver}", |
| ] |
| } |
| |
| executable("libdiag_test") { |
| configs += [ |
| "//common-mk:test", |
| ":libdiag_test_pkg_deps", |
| ] |
| deps = [ |
| ":libdiag", |
| "../common-mk/testrunner:testrunner", |
| ] |
| sources = [ |
| "diag/diag_routine_requester_test.cc", |
| ] |
| } |
| |
| pkg_config("libtelem_test_pkg_deps") { |
| pkg_deps = [ |
| "libchrome-${libbase_ver}", |
| "libchrome-test-${libbase_ver}", |
| ] |
| } |
| |
| executable("libtelem_test") { |
| configs += [ |
| "//common-mk:test", |
| ":libtelem_test_pkg_deps", |
| ] |
| deps = [ |
| ":libtelem", |
| "../common-mk/testrunner:testrunner", |
| ] |
| sources = [ |
| "telem/telem_cache_test.cc", |
| "telem/telem_connection_test.cc", |
| ] |
| } |
| |
| pkg_config("routine_test_pkg_deps") { |
| pkg_deps = [ |
| "libchrome-${libbase_ver}", |
| "libchrome-test-${libbase_ver}", |
| ] |
| } |
| |
| executable("routine_test") { |
| configs += [ |
| "//common-mk:test", |
| ":routine_test_pkg_deps", |
| ] |
| deps = [ |
| ":libdiag_routine", |
| "../common-mk/testrunner:testrunner", |
| ] |
| sources = [ |
| "routines/battery/battery_test.cc", |
| "routines/urandom/urandom_test.cc", |
| "wilco_dtc_supportd/file_test_utils.cc", |
| ] |
| } |
| } |