| # 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/config.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/test.gni") |
| |
| group("fastboot-tcp") { |
| deps = [ ":package" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":fastboot-shared-lib-test-package" ] |
| |
| _is_thinlto = select_variant + [ "thinlto" ] - [ "thinlto" ] != select_variant |
| |
| # TODO(b/318877902): fastboot-tcp-unittests failed in core.x64-thinlto builder. |
| if (!_is_thinlto) { |
| deps += [ ":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 = "2021" |
| |
| deps = [ |
| ":fastboot-shared-lib", |
| "//src/lib/fuchsia", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:byteorder", |
| "//third_party/rust_crates:tracing", |
| ] |
| |
| sources = [ |
| "src/fastboot.rs", |
| "src/fastboot/fastboot_c.rs", |
| "src/main.rs", |
| ] |
| configs -= [ "//build/config/rust/lints:allow_unused_results" ] |
| } |
| |
| 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" ] |
| } |
| |
| config_data("fastboot_tcp_mdns_config") { |
| for_pkg = "mdns" |
| sources = [ rebase_path("config/fastboot_tcp.config") ] |
| |
| # Ensure exclusion from production builds. |
| deps = [ "//build/validate:non_production_tag" ] |
| } |