| # Copyright 2022 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/components.gni") |
| import("//build/config.gni") |
| import("//build/json/validate_json.gni") |
| import("//build/rust/rustc_binary.gni") |
| |
| template("metrics_logger_config") { |
| config_data("${target_name}_config_data") { |
| for_pkg = "metrics-logger" |
| sources = [ "${invoker.source}" ] |
| outputs = [ "config.json" ] |
| } |
| |
| validate_json("${target_name}_validate_json") { |
| data = "${invoker.source}" |
| schema = "config/config.schema.json" |
| } |
| |
| group(target_name) { |
| deps = [ |
| ":${target_name}_config_data", |
| ":${target_name}_validate_json", |
| ] |
| } |
| } |
| |
| rustc_binary("bin") { |
| name = "metrics_logger" |
| edition = "2021" |
| with_unit_tests = true |
| |
| deps = [ |
| "fuchsia.metricslogger.test:fuchsia.metricslogger.test-rustc", |
| "//sdk/fidl/fuchsia.device:fuchsia.device-rustc", |
| "//sdk/fidl/fuchsia.hardware.power.sensor:fuchsia.hardware.power.sensor-rustc", |
| "//sdk/fidl/fuchsia.hardware.temperature:fuchsia.hardware.temperature-rustc", |
| "//sdk/fidl/fuchsia.kernel:fuchsia.kernel-rustc", |
| "//src/lib/diagnostics/inspect/runtime/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-fs", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/trace/rust:trace", |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:async-trait", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_derive", |
| "//third_party/rust_crates:serde_json", |
| ] |
| test_deps = [ "//third_party/rust_crates:assert_matches" ] |
| |
| sources = [ "src/main.rs" ] |
| } |
| |
| fuchsia_package_with_single_component("metrics-logger") { |
| manifest = "meta/metrics-logger.cml" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_unittest_package("metrics-logger-tests") { |
| manifest = "meta/metrics-logger-tests.cml" |
| deps = [ ":bin_test" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":metrics-logger-tests" ] |
| } |