| # 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") |
| |
| if (current_toolchain == target_toolchain) { |
| action("go_toolchain") { |
| go_root = "$host_tools_dir/goroot" |
| |
| # These files are copied over to //out by makefuchsia.go. |
| copied_files = [ |
| "misc/fuchsia/clangwrap.sh", |
| "misc/fuchsia/gccwrap.sh", |
| "misc/fuchsia/go_stdlib_tests.json", |
| ] |
| |
| inputs = copied_files |
| inputs += [ "makefuchsia.go" ] |
| |
| outputs = [ |
| "$root_gen_dir/goroot.done", |
| ] |
| foreach(file, copied_files) { |
| outputs += [ "$go_root/$file" ] |
| } |
| |
| depfile = "$root_gen_dir/goroot.d" |
| |
| visibility = [ ":*" ] |
| |
| script = rebase_path("//buildtools/go") |
| args = [ |
| "run", |
| rebase_path("makefuchsia.go", root_build_dir), |
| "-buildtools-go", |
| rebase_path("//buildtools/go"), |
| "-fuchsia-goroot", |
| rebase_path("."), |
| "-depfile", |
| rebase_path(depfile), |
| "-root-gen-dir", |
| rebase_path("$root_gen_dir"), |
| "-root-out-dir", |
| rebase_path("$root_out_dir"), |
| "--out-goroot", |
| rebase_path(go_root), |
| "-target-cpu", |
| target_cpu, |
| ] |
| } |
| |
| # A symlink from the old location to the new, while we're transitioning |
| # to the new. |
| action("old_go_toolchain_symlink") { |
| old_go_root = "$root_out_dir/goroot" |
| go_root = "$host_tools_dir/goroot" |
| script = "make-goroot-symlink.sh" |
| args = [ |
| rebase_path(go_root), |
| rebase_path(old_go_root), |
| ] |
| outputs = [ |
| old_go_root |
| ] |
| deps = [ |
| ":go_toolchain" |
| ] |
| } |
| } |
| |
| group("go_runtime") { |
| public_deps = [ |
| ":go_toolchain(${target_toolchain})", |
| ":old_go_toolchain_symlink(${target_toolchain})", |
| ] |
| } |
| |
| go_test("go_dispatch_test") { |
| gopackage = "syscall/zx/dispatch" |
| } |
| |
| 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_net_test", |
| ":go_os_test", |
| ":go_zxwait_test", |
| ] |
| |
| tests = [ |
| { |
| name = "go_dispatch_test" |
| }, |
| { |
| name = "go_net_test" |
| }, |
| { |
| name = "go_os_test" |
| }, |
| { |
| name = "go_zxwait_test" |
| }, |
| ] |
| } |