| # Copyright 2022 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. |
| |
| # This file was generated by the `fx create` command. The template |
| # is located at `//tools/create/templates/component-default/BUILD.gn.tmpl-rust`. |
| # If you find something broken, we are eager to review fixes. |
| |
| import("//build/components.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/test.gni") |
| import("//src/sys/core/build/core_shard.gni") |
| |
| group("fastboot-tcp") { |
| deps = [ ":package" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fastboot-shared-lib-test-package", |
| ":fastboot-tcp-unittests", |
| ] |
| } |
| |
| rustc_binary("bin") { |
| output_name = "fastboot-tcp" |
| |
| # Generates a GN target for unit-tests with the label `bin_test`, and |
| # a binary named `fastboot_tcp_bin_test`. |
| with_unit_tests = true |
| edition = "2018" |
| |
| deps = [ |
| ":fastboot-shared-lib", |
| "//src/lib/diagnostics/inspect/runtime/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:byteorder", |
| "//third_party/rust_crates:chrono", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:tracing", |
| ] |
| |
| sources = [ |
| "src/fastboot.rs", |
| "src/fastboot/fastboot_c.rs", |
| "src/main.rs", |
| ] |
| configs -= [ "//build/config/rust:allow_unused_results" ] |
| } |
| |
| # The core realm shard to be used by product integrators. |
| core_shard("fastboot-tcp-core-shard") { |
| shard_file = "meta/fastboot_tcp.core_shard.cml" |
| } |
| |
| fuchsia_component("component") { |
| component_name = "fastboot_tcp" |
| manifest = "meta/fastboot_tcp.cml" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_package("package") { |
| package_name = "fastboot-tcp" |
| deps = [ ":component" ] |
| } |
| |
| # Run with `fx test fastboot-tcp-unittests`. |
| fuchsia_unittest_package("fastboot-tcp-unittests") { |
| deps = [ ":bin_test" ] |
| } |
| |
| shared_library("fastboot-shared-lib") { |
| sources = [ "src/cpp/fastboot.cc" ] |
| visibility = [ ":*" ] |
| deps = [ "//src/firmware/lib/fastboot" ] |
| } |
| |
| test("fastboot-shared-lib-test") { |
| sources = [ "src/cpp/transport-test.cc" ] |
| deps = [ |
| "//src/firmware/lib/fastboot", |
| "//zircon/system/ulib/zxtest", |
| ] |
| } |
| |
| fuchsia_unittest_package("fastboot-shared-lib-test-package") { |
| package_name = "fastboot-shared-lib-test" |
| deps = [ ":fastboot-shared-lib-test" ] |
| } |