|  | # 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/rust/rustc_binary.gni") | 
|  | import("//src/sys/build/components.gni") | 
|  |  | 
|  | group("rust") { | 
|  | testonly = true | 
|  | deps = [ ":tests" ] | 
|  | } | 
|  |  | 
|  | group("tests") { | 
|  | testonly = true | 
|  | deps = [ ":rust-logs-example-tests" ] | 
|  | } | 
|  |  | 
|  | rustc_binary("bin") { | 
|  | name = "rust-logs-example" | 
|  |  | 
|  | deps = [ | 
|  | "//src/lib/fuchsia-async", | 
|  | "//src/lib/fuchsia-component", | 
|  | "//src/lib/syslog/rust:syslog", | 
|  | "//third_party/rust_crates:anyhow", | 
|  | "//third_party/rust_crates:log", | 
|  | "//third_party/rust_crates:tracing", | 
|  | ] | 
|  |  | 
|  | sources = [ "src/main.rs" ] | 
|  | } | 
|  |  | 
|  | rustc_test("test") { | 
|  | name = "rust-logs-example-tests" | 
|  | source_root = "tests/lib.rs" | 
|  |  | 
|  | deps = [ | 
|  | "//sdk/fidl/fuchsia.logger:fuchsia.logger-rustc", | 
|  | "//src/lib/diagnostics/reader", | 
|  | "//src/lib/fuchsia-async", | 
|  | "//src/lib/fuchsia-component", | 
|  | "//src/lib/syslog/rust:syslog", | 
|  | "//src/lib/syslog/rust:syslog-listener", | 
|  | "//third_party/rust_crates:anyhow", | 
|  | "//third_party/rust_crates:futures", | 
|  | "//third_party/rust_crates:pin-utils", | 
|  | ] | 
|  |  | 
|  | sources = [ "tests/lib.rs" ] | 
|  | } | 
|  |  | 
|  | fuchsia_component("component") { | 
|  | component_name = "rust-logs-example" | 
|  | manifest = "meta/rust-logs-example.cmx" | 
|  | deps = [ ":bin" ] | 
|  | } | 
|  |  | 
|  | fuchsia_component("test_component") { | 
|  | testonly = true | 
|  | component_name = "rust-logs-example-tests" | 
|  | manifest = "meta/rust-logs-example-tests.cmx" | 
|  | deps = [ ":test" ] | 
|  | } | 
|  |  | 
|  | # Run with `fx test rust-logs-example-tests`. | 
|  | fuchsia_test_package("rust-logs-example-tests") { | 
|  | test_components = [ ":test_component" ] | 
|  | deps = [ ":component" ] | 
|  | } |