blob: 7c40acb64e2dc3ec151cc08fa136357efcd19368 [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/product.gni")
import("//build/sdk/sdk_host_tool.gni")
import("//build/testing/host_test.gni")
import("//build/testing/host_test_data.gni")
import("//build/tools/json_merge/json_merge.gni")
import("//src/storage/fshost/generated_fshost_config.gni")
import("config.gni")
group("ffx") {
testonly = true
public_deps = [
":ffx-defaults.json($host_toolchain)",
":ffx_tool($host_toolchain)",
":tests",
"lib($host_toolchain)",
]
}
if (is_host) {
group("ffx_tool") {
deps = [
":host",
"frontends/ffx:ffx_bin($host_toolchain)",
"tools($host_toolchain)",
]
}
install_host_tools("host") {
deps = [ "frontends/ffx:ffx_bin" ]
outputs = [ "ffx" ]
}
group("runtime") {
deps = [
# The tool
":host",
]
}
group("ffx_bin") {
public_deps = [ "frontends/ffx:ffx_bin" ]
# Please prefer to use the appropriate host_test_data target defined below
# rather than directly depending on the ffx binary.
#
# The targets to use instead are:
# - ffx itself (`//src/developer/ffx:test_data`) if only using core
# functionality of ffx (no plugins not listed in `config.gni`'s
# `required_ffx_plugins` or `included_ffx_plugins` lists). This should be
# the rare case.
# - the whole "suite" of tools (`//src/developer/ffx:suite_test_data`) if
# a many subtools are used, or the subtools used aren't really usefully
# constrained.
# - a specific subtool's test data (eg.
# `//src/developer/ffx/plugins/tool:test_data`) if only one subtool is
# used and it's reasonable to write the test to call it directly (as
# `ffx-tool tool <args>` through fho's compatibility mode).
# - the SDK as a whole (See the `host_test_data("sdk_exported")`, for example:
# ```
# host_test_data("sdk_exported") {
# sources = [ get_label_info("//sdk:core($default_toolchain)",
# "root_out_dir") + "/sdk/exported/core" ]
#
# deps = [ "//sdk:core($default_toolchain)" ]
# }
# ```
#
# If you find yourself hitting this on something new, please try to use
# one of the above instead and if you're unsure reach out to the tools
# team for advice.
#
# TODO(b/296236928): change sdk description above to a reference to a
# normalized host_test_data.
visibility = [
# These are well-defined users of the direct binary dependency and do not
# need to change.
"//bundles/infra/*",
"//src/developer/ffx/*",
# TODO(b/296235955) Some things in vendor directories depend on this and
# probably shouldn't. We should fix that and remove this.
"//vendor/*",
# Dart tests require special handling for their own kind of isolation, so
# these are 'allowed' to use this directly so they can copy it in where
# it's needed.
"//src/tests/end_to_end/package_manager:*",
# TODO(b/295921890): The following are dependencies that existed at the
# time this visibility list was established, and they should eventually be
# moved to use the appropriate shared host_test_data.
"//build/assembly/update_package:*",
"//sdk/ctf/tests/examples/host_tool:*",
"//src/devices/bin/driver_tools/tests:*",
"//src/tests/end_to_end/*",
"//third_party/antlion/*",
"//tools/blackout/blackout-integration:*",
"//tools/blackout/blobfs-checkerboard:*",
"//tools/blackout/fs-tree:*",
]
}
sdk_host_tool("bin_sdk") {
# TODO(https://fxbug.dev/42135146): 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_data("test_data") {
# Needed for SDK inclusion
#
# TODO(b/330934833): Remove when IDK allows for `testonly` targets in dep
# tree or when we can separate the concept of data_dep from host_test_data.
testonly = false
deps = [ ":host" ]
sources = [ "${host_tools_dir}/ffx" ]
}
group("suite_test_data") {
testonly = true
public_deps = [ ":test_data" ]
if (ffx_build_dual_mode_plugins_as_subtools) {
public_deps += dual_mode_subtool_test_data
}
}
json_merge("ffx-defaults.json") {
# the "DEFAULT" config level will be made up of a json merge of the following
# source json, some of which may be generated. Anything that's part of an
# ffx_plugin() definition included under the main ffx binary will automatically
# be merged in by that machinery, but if it comes from an external subtool or a library
# it has to be manually added to this list.
sources = [
rebase_path("//src/developer/ffx/data/config.json"),
rebase_path("//src/developer/ffx/daemon/data/config.json"),
rebase_path("//src/developer/ffx/lib/pbms/data/config.json"),
]
# Add in the 'dual-mode' config default files if we're doing dual mode
if (ffx_build_dual_mode_plugins_as_subtools) {
foreach(config, dual_mode_defaults) {
sources += [ rebase_path(config) ]
}
}
# Add any dynamically generated config.json files (ie. from ffx plugin roots) here.
deps = [
# This will bring in all built-in subtool config.json files.
"//src/developer/ffx/frontends/ffx:config.json($host_toolchain)",
# These are separate subtools with plugin-generated config.json
"//src/developer/ffx/plugins/emulator:config.json($host_toolchain)",
"//src/developer/ffx/plugins/log:config.json($host_toolchain)",
"//src/developer/ffx/plugins/test:config.json($host_toolchain)",
"//src/developer/ffx/plugins/trace:config.json($host_toolchain)",
]
foreach(dep, deps) {
sources += [ get_label_info(dep, "target_out_dir") + "/config.json" ]
}
}
}
# NOTE: this group is included in `//src/developer:tests` and `//src:tests` which get added as
# dependencies of the system image in infra builds. Tests which need to depend on a system image
# should be added to `host_tests` below.
group("tests") {
testonly = true
deps = [
# Driver tests
"frontends/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)",
"playground:tests($host_toolchain)",
"plugins/package:tests($host_toolchain)",
"tests($host_toolchain)",
]
}
# NOTE: this group is for tests which need to transitively depend on a Fuchsia system image for
# "e2e" testing of ffx behavior. These are included in `//bundles/buildbot/host` in order to prevent
# dep cycles.
if (is_host) {
group("host_tests") {
testonly = true
deps = []
# ffx e2e host tests have a few constraints:
#
# 1. the assembly targets don't build correctly on mac bots
# 2. bringup bots can't depend on the main assembly that's used for ffx e2e tests
# 3. the minfs-no_hardware bot doesn't launch the emulator correctly
if (is_linux && !use_bringup_assembly &&
data_filesystem_format != "minfs") {
deps += [
"lib:host_tests",
"plugins:host_tests",
"tools:host_tests",
]
}
}
}
if (is_fuchsia) {
group("package_deps_for_host_tests") {
testonly = true
deps = [
"plugins:package_deps_for_host_tests",
"tools/target-package/tests:package_deps_for_host_tests",
]
}
}
# Tests that are end to end, and should be part of the e2e test suite.
group("e2e_tests") {
testonly = true
deps = [
"lib/fuchsia-controller:e2e_tests($host_toolchain)",
"plugins/emulator:e2e_tests",
"tests:e2e_tests($host_toolchain)",
]
}