blob: f8723b383614a442e4ef56acc3fb438a97143eea [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("//build/images/shell_commands.gni")
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
#
# deps
# testonly
# visibility
template("fuchsia_shell_package") {
package_name = target_name
if (defined(invoker.package_name)) {
package_name = invoker.package_name
}
shell_command_target = "${target_name}_shell_command"
shell_command(shell_command_target) {
forward_variables_from(invoker,
[
"deps",
"testonly",
])
visibility = [ ":*" ]
package_name = package_name
}
if (defined(invoker.manifest)) {
component_target = "${target_name}_component"
fuchsia_component(component_target) {
forward_variables_from(invoker,
[
"deps",
"testonly",
])
visibility = [ ":*" ]
manifest = invoker.manifest
component_name = invoker.target_name
}
}
fuchsia_package(target_name) {
forward_variables_from(invoker,
[
"deps",
"testonly",
"visibility",
])
package_name = package_name
if (!defined(deps)) {
deps = []
}
deps += [ ":$shell_command_target" ]
if (defined(component_target)) {
deps += [ ":$component_target" ]
}
# The shell environment is not intended for production use.
deps += [ "//build/validate:non_production_tag" ]
}
}