blob: b6e94afc72d80dc099807dbf556e7d79a225f3ef [file] [log] [blame]
# Copyright 2017 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.
# A template for an action that creates a Fuchsia Go binary.
template("go_binary") {
assert(defined(invoker.gopackage),
"gopackage must be defined for $target_name")
action(target_name) {
forward_variables_from(invoker, [ "deps" ])
out_path = "$root_out_dir/$target_name"
outputs = [ out_path ]
script = rebase_path("//.") + "/build/gobuild.py"
depfile_path = "${out_path}.d"
depfile = depfile_path
console = true # only run one gobuild.py at once
args = [
"--fuchsia-root",
rebase_path("//."),
"--root-out-dir",
rebase_path("$root_out_dir"),
"--depfile",
rebase_path(depfile_path),
"--current-cpu",
current_cpu,
"--go-tool",
rebase_path("//buildtools/go"),
"--binname",
rebase_path("$out_path"),
invoker.gopackage,
]
if (!defined(deps)) {
deps = []
}
deps += [ "//third_party/go:go_runtime" ]
}
}