blob: 233c6cb067e0742515c53aba36c915de4ce4b875 [file] [log] [blame]
# Copyright 2016 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/config/sysroot.gni")
import("//build/go/go_test.gni")
import("//build/host.gni")
import("//build/package.gni")
import("//build/fidl/fidl.gni")
if (current_toolchain == target_toolchain) {
_go_root = "$host_tools_dir/goroot"
_bootstrap_goroot = "//buildtools/${host_platform}/go"
action("makeroot") {
visibility = [ ":makefuchsia" ]
inputs = [ "makeroot.go" ]
depfile = "$target_gen_dir/$target_name.d"
outputs = [ "$target_gen_dir/$target_name.stamp" ]
script = rebase_path(_bootstrap_goroot + "/bin/go")
args = [
"run",
rebase_path("makeroot.go", root_build_dir),
"-source-goroot",
rebase_path(".", root_build_dir),
"-target-goroot",
rebase_path(_go_root, root_build_dir),
"-depfile",
rebase_path(depfile, root_build_dir),
"-depfile-root",
rebase_path(root_build_dir),
"-stamp-file",
rebase_path(outputs[0], root_build_dir)
]
}
action("makefuchsia") {
visibility = [ ":go_runtime" ]
deps = [":makeroot"]
depfile = "$target_gen_dir/$target_name.d"
outputs = [ "$target_gen_dir/$target_name.stamp" ]
script = rebase_path(_bootstrap_goroot + "/bin/go")
args = [
"run",
rebase_path("makefuchsia.go", root_build_dir),
"-bootstrap-goroot",
rebase_path(_bootstrap_goroot),
"-goroot",
rebase_path(_go_root, root_build_dir),
"-depfile",
rebase_path(depfile, root_build_dir),
"-depfile-root",
rebase_path(root_build_dir),
"-stamp-file",
rebase_path(outputs[0], root_build_dir),
]
}
}
group("go_runtime") {
public_deps = [
":makefuchsia(${target_toolchain})",
]
}
go_test("go_dispatch_test") {
gopackage = "syscall/zx/dispatch"
}
go_test("go_fidl_test") {
gopackage = "syscall/zx/fidl/fidl_test"
# TODO(pascallouis): Currently, while we take a dependency, the output of
# this FIDL rule is not directly used, rather the generated bindings were
# copied and checked in.
#
# Not being able to depend on automated generation is due to where code is
# placed, and how this relates to the tree structure of the toolchain.
deps = [
"src/syscall/zx/fidl/bindingstest($go_toolchain)",
]
}
go_test("go_zxwait_test") {
gopackage = "syscall/zx/zxwait"
}
go_test("go_os_test") {
gopackage = "os"
}
go_test("go_net_test") {
gopackage = "net"
}
package("go_stdlib_tests") {
testonly = true
deps = [
":go_dispatch_test",
":go_fidl_test",
":go_os_test",
":go_net_test",
":go_zxwait_test",
]
tests = [
{
name = "go_dispatch_test"
},
{
name = "go_fidl_test"
},
{
name = "go_net_test"
},
{
name = "go_os_test"
},
{
name = "go_zxwait_test"
},
]
}