Fix compiled action dependencies in GN.

The yasm uses of compiled action used sources instead of inputs. Sources applies to the _foreach version but not the plain "compiled_action". These did not trigger an unused variable warning because the declarations themselves dereferenced the sources variable for computing args to the script.

This adds some extra documentation and assertion to the compiled action template. It also adds the binary itself as an input. This should be strictly unnecessary since there should be an implicit dependency on the target, but I like this since it makes things more explicit.

R=ajwong@chromium.org

Review URL: https://codereview.chromium.org/505403002

Cr-Original-Commit-Position: refs/heads/master@{#292447}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 4b04efb439a19c6dfef213a2fe51751b223f9cbd
This commit is contained in:
Brett Wilson 2014-08-28 13:24:32 -07:00
Родитель 3258a26c62
Коммит 151cb2d170
1 изменённых файлов: 18 добавлений и 1 удалений

Просмотреть файл

@ -23,8 +23,12 @@
# args (required)
# [list of strings] Same meaning as action/action_foreach.
#
# inputs (optional)
# Files the binary takes as input. The step will be re-run whenever any
# of these change. If inputs is empty, the step will run only when the
# binary itself changes.
#
# visibility
# inputs
# deps
# args (all optional)
# Same meaning as action/action_foreach.
@ -67,6 +71,9 @@ template("compiled_action") {
assert(defined(invoker.outputs), "outputs must be defined for $target_name")
assert(defined(invoker.args), "args must be defined for $target_name")
assert(!defined(invoker.sources),
"compiled_action doesn't take a sources arg. Use inputs instead.")
action(target_name) {
if (defined(invoker.visibility)) {
visibility = invoker.visibility
@ -76,6 +83,8 @@ template("compiled_action") {
if (defined(invoker.inputs)) {
inputs = invoker.inputs
} else {
inputs = []
}
outputs = invoker.outputs
@ -90,6 +99,9 @@ template("compiled_action") {
host_executable = get_label_info(host_tool, "root_out_dir") + "/" +
get_label_info(host_tool, "name")
# Add the executable itself as an input.
inputs += [ host_executable ]
deps = [ host_tool ]
if (defined(invoker.deps)) {
deps += invoker.deps
@ -120,6 +132,8 @@ template("compiled_action_foreach") {
if (defined(invoker.inputs)) {
inputs = invoker.inputs
} else {
inputs = []
}
outputs = invoker.outputs
@ -134,6 +148,9 @@ template("compiled_action_foreach") {
host_executable = get_label_info(host_tool, "root_out_dir") + "/" +
get_label_info(host_tool, "name")
# Add the executable itself as an input.
inputs += [ host_executable ]
deps = [ host_tool ]
if (defined(invoker.deps)) {
deps += invoker.deps