blob: 50734a325af4d86dda4a15327dcdfd0f7c3cc746 [file] [log] [blame]
# Copyright 2019 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/host.gni")
import("//build/sdk/sdk_host_tool.gni")
import("//build/testing/host_test.gni")
import("//build/testing/host_test_data.gni")
import("./build/ffx.gni")
# A note for developers interested in generating a Cargo.toml file for this tool:
# FFX generates a `ffx_bin_unversioned` rule, which is what should be used as the target for
# cargo gen. The appropriate command is:
# `fx gen-cargo '//src/developer/ffx:ffx_bin_unversioned(//build/toolchain:host_x64)'`
group("ffx") {
testonly = true
public_deps = [
":ffx_tool",
":tests",
"lib",
]
}
if (is_host) {
ffx("ffx") {
version = "0.1.0"
edition = "2021"
with_unit_tests = true
plugin_deps = [
"//src/connectivity/network/net-cli/ffx:ffx_net",
"//src/connectivity/network/testing/network-test-realm/ffx:ffx_net_test_realm",
"//src/developer/ffx/plugins/agis:ffx_agis",
"//src/developer/ffx/plugins/assembly:ffx_assembly",
"//src/developer/ffx/plugins/component:ffx_component",
"//src/developer/ffx/plugins/config:ffx_config_plugin",
"//src/developer/ffx/plugins/coverage:ffx_coverage",
"//src/developer/ffx/plugins/cts:ffx_cts",
"//src/developer/ffx/plugins/daemon:ffx_daemon_plugin",
"//src/developer/ffx/plugins/debug:ffx_debug_plugin",
"//src/developer/ffx/plugins/doctor:ffx_doctor",
"//src/developer/ffx/plugins/driver:ffx_driver",
"//src/developer/ffx/plugins/efi:ffx_efi",
"//src/developer/ffx/plugins/emulator:ffx_emulator",
"//src/developer/ffx/plugins/flutter:ffx_flutter",
"//src/developer/ffx/plugins/inspect:ffx_inspect",
"//src/developer/ffx/plugins/log:ffx_log",
"//src/developer/ffx/plugins/overnet:ffx_overnet_plugin",
"//src/developer/ffx/plugins/package:ffx_package",
"//src/developer/ffx/plugins/pdk:ffx_pdk",
"//src/developer/ffx/plugins/platform:ffx_platform",
"//src/developer/ffx/plugins/product:ffx_product",
"//src/developer/ffx/plugins/product_bundle:ffx_product_bundle",
"//src/developer/ffx/plugins/profile:ffx_profile",
"//src/developer/ffx/plugins/repository:ffx_repository",
"//src/developer/ffx/plugins/schema:ffx_schema",
"//src/developer/ffx/plugins/scrutiny:ffx_scrutiny",
"//src/developer/ffx/plugins/sdk:ffx_sdk",
"//src/developer/ffx/plugins/self-test:ffx_selftest",
"//src/developer/ffx/plugins/session:ffx_session",
"//src/developer/ffx/plugins/setui:ffx_setui",
"//src/developer/ffx/plugins/starnix:ffx_starnix",
"//src/developer/ffx/plugins/target:ffx_target",
"//src/developer/ffx/plugins/test:ffx_test",
"//src/developer/ffx/plugins/trace:ffx_trace",
"//src/developer/ffx/plugins/triage:ffx_triage",
"//src/developer/ffx/plugins/version:ffx_version",
"//src/developer/ffx/plugins/wlan:ffx_wlan",
"//src/storage/ffx:ffx_storage",
]
args_sources = [ "src/args.rs" ]
args_deps = [
"//src/developer/ffx/config:lib",
"//src/developer/ffx/lib/writer:lib",
]
sources = [
"src/lib.rs",
"src/main.rs",
]
test_deps = [
"//sdk/fidl/fuchsia.developer.ffx:fuchsia.developer.ffx-rustc",
"//sdk/fidl/fuchsia.overnet:fuchsia.overnet-rustc",
"//src/connectivity/overnet/lib/ascendd",
"//third_party/rust_crates:async-lock",
"//third_party/rust_crates:tempfile",
]
}
sdk_host_tool("bin_sdk") {
# TODO(fxbug.dev/57313): partner only at this time while we shake
# out alpha bugs and fill-in docs, etc.
category = "partner"
output_name = "ffx"
deps = [ ":ffx_bin" ]
}
host_test("ffx-e2e-without-target") {
binary_path = "$root_out_dir/ffx"
args = [
"self-test",
"--include-target",
"false",
]
deps = [ ":ffx_bin" ]
}
host_test("ffx-e2e-with-target") {
binary_path = "$root_out_dir/ffx"
args = [
"--config",
"sdk.root=.,sdk.type=in-tree",
"self-test",
]
deps = [
":ffx-e2e-test-data",
":ffx_bin",
# Required by the test_debug_limbo in `ffx self-test`.
# We cannot add it to the dependency of `ffx self-test` plugin because that will make
# the crasher into all production builds.
"//src/developer/forensics/crasher($target_toolchain)",
]
# TODO(fxbug.dev/60683): split additional dimensions such as multi-device
# mac + device, etc.
environments = [
# XXX(fxbug.dev/64897): support arm64 HTI tests
# emu_env,
nuc_env,
]
}
host_test_data("ffx-e2e-test-data") {
sources = [
"$root_out_dir/gen/src/developer/debug/zxdb/zxdb_sdk.meta.json",
"$root_out_dir/zxdb",
]
}
}
install_host_tools("host") {
deps = [ ":ffx_bin" ]
outputs = [ "ffx" ]
}
group("ffx_tool") {
deps = [
":ffx_bin($host_toolchain)",
":host",
]
}
group("runtime") {
deps = [
# The tool
":host",
# Target-side dependencies
"//src/developer/remote-control:runtime",
]
}
group("tests") {
testonly = true
deps = [
# ffx end to end tests, through `ffx self-test` invocations, one includes
# tests that must have a target present, the other can be run without a
# target present.
":ffx-e2e-with-target($host_toolchain)",
":ffx-e2e-without-target($host_toolchain)",
# Most ffx plugin test suites are included downstream of the group defined
# by the ffx template above.
":ffx_tests($host_toolchain)",
# Individual library tests, for libraries that are not plugins.
"lib:tests($host_toolchain)",
"logger:tests($host_toolchain)",
"plugins/package:tests($host_toolchain)",
]
}