blob: 8549975637112afd3053d181497c549a82e7f6ce [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" ])
output_name = target_name
if (defined(invoker.output_name)) {
output_name = invoker.output_name
}
out_path = "$root_out_dir/$output_name"
outputs = [ out_path ]
script = rebase_path("//build/go/build.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,
"--current-os",
current_os,
"--go-tool",
rebase_path("//buildtools/go"),
"--binname",
rebase_path("$out_path"),
invoker.gopackage,
]
if (!defined(deps)) {
deps = []
}
deps += [ "//third_party/go:go_runtime" ]
}
}