# 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.
# saves unnecessarily compiling your tool for the target platform. But if you
# need a target build of your tool as well, just leave off the if statement.
+if (build_os == "win") {
+ _host_executable_suffix = ".exe"
+} else {
+ _host_executable_suffix = ""
+}
+
template("compiled_action") {
assert(defined(invoker.tool), "tool must be defined for $target_name")
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
if (defined(invoker.inputs)) {
inputs = invoker.inputs
+ } else {
+ inputs = []
}
outputs = invoker.outputs
# specify this, since we can't know what the output name is (it might be in
# another file not processed yet).
host_executable = get_label_info(host_tool, "root_out_dir") + "/" +
- get_label_info(host_tool, "name")
+ get_label_info(host_tool, "name") + _host_executable_suffix
+
+ # Add the executable itself as an input.
+ inputs += [ host_executable ]
deps = [ host_tool ]
if (defined(invoker.deps)) {
if (defined(invoker.inputs)) {
inputs = invoker.inputs
+ } else {
+ inputs = []
}
outputs = invoker.outputs
# specify this, since we can't know what the output name is (it might be in
# another file not processed yet).
host_executable = get_label_info(host_tool, "root_out_dir") + "/" +
- get_label_info(host_tool, "name")
+ get_label_info(host_tool, "name") + _host_executable_suffix
+
+ # Add the executable itself as an input.
+ inputs += [ host_executable ]
deps = [ host_tool ]
if (defined(invoker.deps)) {