| # Copyright 2021 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. | |
| assert(is_fuchsia, "These targets are only compiled in the fuchsia toolchain.") | |
| # [START imports] | |
| import("//build/components.gni") | |
| import("//build/rust/rustc_binary.gni") | |
| # [END imports] | |
| group("hermetic_tests") { | |
| testonly = true | |
| deps = [ ":echo-rust-unittests" ] | |
| } | |
| # [START executable] | |
| rustc_binary("bin") { | |
| output_name = "echo_example_rust" | |
| edition = "2024" | |
| # Generates a GN target for unit-tests with the label `bin_test`, | |
| # and a binary named `echo_bin_test`. | |
| with_unit_tests = true | |
| deps = [ | |
| "//src/lib/fuchsia", | |
| "//third_party/rust_crates:anyhow", | |
| "//third_party/rust_crates:log", | |
| ] | |
| sources = [ "src/main.rs" ] | |
| } | |
| # [END executable] | |
| # [START component] | |
| fuchsia_component("component") { | |
| component_name = "echo_rust" | |
| manifest = "meta/echo.cml" | |
| deps = [ ":bin" ] | |
| } | |
| # [END component] | |
| # [START unittest] | |
| fuchsia_unittest_package("echo-rust-unittests") { | |
| deps = [ ":bin_test" ] | |
| } | |
| # [END unittest] |