blob: c9b68b28eff4b04d98cefe454247b29077a124fc [file] [log] [blame] [edit]
# 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($host_toolchain)",
"tools($host_toolchain)",
]
}
if (is_host) {
ffx("ffx") {
version = "0.1.0"
edition = "2021"
with_unit_tests = true
# Essential plugins you can't really use ffx without, don't remove these
# when trying to build a cut-down ffx
plugin_deps = [
"//src/developer/ffx/plugins/config:ffx_config_plugin",
"//src/developer/ffx/plugins/daemon:ffx_daemon_plugin",
"//src/developer/ffx/plugins/schema:ffx_schema",
"//src/developer/ffx/plugins/target:ffx_target",
"//src/developer/ffx/plugins/version:ffx_version",
]
# Plugins that can be disabled without breaking ffx as a whole. You
# can do so in local development to reduce compile times while iterating on
# a specific plugin.
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/audio:ffx_audio",
"//src/developer/ffx/plugins/component:ffx_component",
"//src/developer/ffx/plugins/coverage:ffx_coverage",
"//src/developer/ffx/plugins/cts:ffx_cts",
"//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/fuzz:ffx_fuzz",
"//src/developer/ffx/plugins/input:ffx_input",
"//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/platform:ffx_platform",
"//src/developer/ffx/plugins/power:ffx_power",
"//src/developer/ffx/plugins/process_explorer:ffx_process_explorer",
"//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/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/sl4f:ffx_sl4f_plugin",
"//src/developer/ffx/plugins/starnix:ffx_starnix",
"//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/wlan:ffx_wlan",
"//src/storage/ffx:ffx_storage",
"//src/virtualization/ffx:ffx_guest",
]
deps = [ "//third_party/rust_crates:anyhow" ]
ffx_deps = [
"//src/developer/ffx:ffx_lib_args",
"//src/developer/ffx:ffx_lib_sub_command",
"//src/developer/ffx:ffx_lib_suite",
"//src/developer/ffx/command:lib",
"//src/developer/ffx/config:lib",
"//src/developer/ffx/lib/errors:lib",
"//src/developer/ffx/lib/fho:lib",
"//src/developer/ffx/plugins/daemon:ffx_daemon_plugin_args",
"//src/developer/ffx/plugins/daemon:ffx_daemon_plugin_sub_command",
"//src/lib/fuchsia-async",
"//third_party/rust_crates:argh",
"//third_party/rust_crates:async-trait",
"//third_party/rust_crates:tempfile",
]
args_sources = [ "src/args.rs" ]
sources = [
"src/lib.rs",
"src/main.rs",
]
}
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)",
# Subtool tests
"tools:tests($host_toolchain)",
# Individual library tests, for libraries that are not plugins.
"command:tests($host_toolchain)",
"config:tests($host_toolchain)",
"core:tests($host_toolchain)",
"daemon:tests($host_toolchain)",
"lib:tests($host_toolchain)",
"logger:tests($host_toolchain)",
"plugins/package:tests($host_toolchain)",
"tests",
]
}