blob: 5e782daabdc09abfd2bc451c86901d2ae413a167 [file] [log] [blame]
# Copyright 2020 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("fuchsia_component.gni")
import("fuchsia_package.gni")
# Defines a package that contains shell commands.
# See: https://fuchsia.dev/fuchsia-src/development/components/build
#
# Parameters
#
# package_name (optional)
# The name of the package.
# Type: string
# Default: target_name
#
# manifest (optional)
# If your shell program can also be launched as a component,
# then specify the component manifest here.
# Type: path
#
# data_deps
# deps
# testonly
# visibility
template("fuchsia_shell_package") {
if (current_toolchain == default_toolchain) {
package_name = target_name
if (defined(invoker.package_name)) {
package_name = invoker.package_name
}
if (defined(invoker.manifest)) {
component_target = "${target_name}_component"
fuchsia_component(component_target) {
forward_variables_from(invoker,
[
"data_deps",
"deps",
"manifest_deps",
"testonly",
])
visibility = [ ":*" ]
manifest = invoker.manifest
component_name = package_name
}
}
fuchsia_package(target_name) {
forward_variables_from(invoker,
[
"shell_commands",
"data_deps",
"deps",
"disable_elf_binaries_checks",
"testonly",
"visibility",
])
is_shell_package = true
package_name = package_name
if (!defined(deps)) {
deps = []
}
if (defined(component_target)) {
deps += [ ":$component_target" ]
}
# The shell environment is not intended for production use.
deps += [ "//build/validate:non_production_tag" ]
}
} else {
group(target_name) {
forward_variables_from(invoker,
[
"testonly",
"visibility",
])
deps = [ ":$target_name($default_toolchain)" ]
}
not_needed(invoker, "*")
}
}