| # 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/config.gni") |
| import("//build/package.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/test/test_package.gni") |
| import("//src/diagnostics/sampler/build/config_generator.gni") |
| import("//src/sys/build/components.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 = "2018" |
| with_unit_tests = true |
| |
| deps = [ |
| "//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", |
| "//src/diagnostics/control:controller-rustc", |
| "//src/lib/diagnostics/hierarchy/rust", |
| "//src/lib/diagnostics/inspect/derive", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/diagnostics/reader/rust", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/syslog/rust:syslog", |
| "//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: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:log", |
| "//third_party/rust_crates:matches", |
| "//third_party/rust_crates:parking_lot", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:serde_json5", |
| "//third_party/rust_crates:tempfile", |
| "//third_party/rust_crates:thiserror", |
| ] |
| |
| sources = [ |
| "src/config.rs", |
| "src/diagnostics.rs", |
| "src/executor.rs", |
| "src/lib.rs", |
| ] |
| } |
| |
| # Test package for the unit test from the |
| # lapis library. |
| test_package("sampler-tests") { |
| deps = [ ":lib_test" ] |
| |
| v2_tests = [ |
| { |
| name = "sampler_lib_test" |
| environments = basic_envs |
| }, |
| ] |
| } |
| |
| # Custom build rule responsible for generating them |
| # default config-data the production Lapis service uses |
| # as well as the resource rule used by the configuration |
| # verification test. |
| lapis_configuration("production_lapis") { |
| configs = [ |
| "config/archivist.json", |
| "config/ftl.json", |
| "config/fvm.json", |
| "config/system-update-committer.json", |
| ] |
| } |
| |
| # Rules defining the V1 and V2 Lapis components. |
| fuchsia_component("sampler-component") { |
| component_name = "sampler" |
| deps = [ |
| ":production_lapis_config_data", |
| "//src/diagnostics/launcher:bin", |
| ] |
| manifest = "meta/sampler.cml" |
| } |
| |
| fuchsia_component("sampler-v1") { |
| component_name = "sampler" |
| manifest = "meta/sampler.cmx" |
| deps = [ |
| ":lib", |
| "//src/diagnostics/launcher:bin", |
| ] |
| } |
| |
| fuchsia_package("sampler") { |
| deps = [ ":sampler-component" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":sampler-tests", |
| "tests:sampler-integration-tests", |
| ] |
| } |