blob: c72f9e34a9560136747e86034368d2662439adbd [file] [log] [blame]
# Copyright 2021 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")
# The label and output file for running `gn desc` on the outdir.
gn_desc_json = "gn_desc.json"
if (current_toolchain == default_toolchain) {
gn_desc_json_file = "${root_build_dir}/${gn_desc_json}"
# This is a target that is used to also cause the gn_desc.json file to be
# created when the host tool is created, and can be used to regenerate the
# file as-needed.
action(gn_desc_json) {
script = "//scripts/generate_gn_desc.py"
outputs = [ gn_desc_json_file ]
depfile = "$target_out_dir/$gn_desc_json.d"
hermetic_deps = false
no_output_dir_leaks = false
args = [
"--fuchsia_dir",
rebase_path("//", root_build_dir),
"--gn_binary",
rebase_path("//prebuilt/third_party/gn/${host_platform}/gn",
root_build_dir),
"--output",
rebase_path(gn_desc_json_file, root_build_dir),
"--depfile",
rebase_path(depfile, root_build_dir),
]
}
}
if (is_host) {
# The default target adds the tool and the generation of the `gn_desc.json`
# file to the build graph.
group("gn_desc") {
testonly = true
deps = [
":${gn_desc_json}($default_toolchain)",
":install_gn_desc($host_toolchain)",
]
}
# This makes the binary available to fx. It also lists the gn_desc.json target
# as a dependency so that if the tool is installed, then `gn desc` is always
# run and a file available for it to use.
install_host_tools("install_gn_desc") {
testonly = true
deps = [
":${gn_desc_json}($default_toolchain)",
"bin:gn_desc",
]
outputs = [ "gn_desc" ]
}
# All the tests.
group("host_tests") {
testonly = true
deps = [
"bin:tests",
"gn_graph:tests",
"gn_json:tests",
"tests",
]
}
}