| # Copyright 2020 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/rust/rustc_library.gni") |
| |
| # Library containing core logic for sampler, |
| # library launched by generic diagnostics Launcher |
| # to bundle multiple products together and save space. |
| rustc_library("lib") { |
| name = "sampler" |
| edition = "2021" |
| with_unit_tests = true |
| |
| visibility = [ |
| "//src/diagnostics/launcher/*", |
| "//src/diagnostics/sampler/*", |
| ] |
| |
| deps = [ |
| ":sampler-component-config", |
| "//sdk/fidl/fuchsia.cobalt:fuchsia.cobalt-rustc", |
| "//sdk/fidl/fuchsia.diagnostics:fuchsia.diagnostics-rustc", |
| "//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol-rustc", |
| "//sdk/fidl/fuchsia.metrics:fuchsia.metrics-rustc", |
| "//src/diagnostics/lib/sampler-config", |
| "//src/lib/diagnostics/data/rust", |
| "//src/lib/diagnostics/hierarchy/rust", |
| "//src/lib/diagnostics/inspect/derive", |
| "//src/lib/diagnostics/inspect/runtime/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/diagnostics/reader/rust", |
| "//src/lib/diagnostics/selectors", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/syslog/rust:syslog-listener", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:async-trait", |
| "//third_party/rust_crates:chrono", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:itertools", |
| "//third_party/rust_crates:lazy_static", |
| "//third_party/rust_crates:parking_lot", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tracing", |
| ] |
| |
| test_deps = [ "//src/lib/fuchsia" ] |
| |
| sources = [ |
| "src/diagnostics.rs", |
| "src/executor.rs", |
| "src/lib.rs", |
| ] |
| } |
| |
| # Test package for the unit test from the |
| # sampler library. |
| fuchsia_unittest_package("sampler-tests") { |
| deps = [ ":lib_test" ] |
| manifest = "meta/sampler_lib_test.cml" |
| } |
| |
| # Rules defining the Sampler component. |
| fuchsia_component_manifest("sampler-manifest") { |
| component_name = "sampler" |
| manifest = "meta/sampler.cml" |
| } |
| |
| fuchsia_component("sampler-component") { |
| cm_label = ":sampler-manifest" |
| deps = [ |
| "//src/diagnostics/config/sampler:sampler-config-data", |
| "//src/diagnostics/launcher:bin", |
| ] |
| } |
| |
| fuchsia_structured_config_values("sampler-prod-config") { |
| values_source = "configs/default.json5" |
| cm_label = ":sampler-manifest" |
| } |
| |
| fuchsia_structured_config_rust_lib("sampler-component-config") { |
| cm_label = ":sampler-manifest" |
| } |
| |
| fuchsia_package("sampler") { |
| deps = [ |
| ":sampler-component", |
| ":sampler-prod-config", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":sampler-tests", |
| "tests", |
| ] |
| } |