| # 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") |
| import("//src/sys/core/build/core_shard.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.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol_rust", |
| "//sdk/fidl/fuchsia.metrics:fuchsia.metrics_rust", |
| "//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/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:futures", |
| "//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/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", |
| ] |
| } |
| |
| core_shard("core_shard") { |
| shard_file = "meta/sampler.core_shard.cml" |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":sampler-tests", |
| "tests", |
| ] |
| } |