OLD | NEW |
(Empty) | |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 declare_args() { |
| 6 # By default, there is no go build tool, because go builds are not supported. |
| 7 go_build_tool = "" |
| 8 } |
| 9 |
| 10 template("go_test_binary") { |
| 11 # Only available on linux for now. |
| 12 assert(is_linux) |
| 13 assert(defined(invoker.sources)) |
| 14 assert(go_build_tool != "") |
| 15 |
| 16 static_library_name = target_name + "_static_library" |
| 17 |
| 18 static_library(static_library_name) { |
| 19 sources = invoker.additional_sources |
| 20 deps = invoker.deps |
| 21 complete_static_lib = true |
| 22 } |
| 23 |
| 24 action(target_name) { |
| 25 deps = [ |
| 26 ":$static_library_name", |
| 27 ] |
| 28 script = "//build/go/go.py" |
| 29 outputs = [ "${target_out_dir}/${target_name}" ] |
| 30 # Since go test does not permit specifying an output directory or output |
| 31 # binary name, we create a temporary build directory, and the python |
| 32 # script will later identify the output, copy it to the target location, |
| 33 # and clean up the temporary build directory. |
| 34 build_dir = "${target_out_dir}/${target_name}_build" |
| 35 args = [ |
| 36 "--", |
| 37 "${go_build_tool}", |
| 38 rebase_path(build_dir, root_build_dir), |
| 39 rebase_path(target_out_dir, root_build_dir) + "/${target_name}", |
| 40 rebase_path("//", root_build_dir), |
| 41 "-I" + rebase_path("//"), |
| 42 " -L" + rebase_path(target_out_dir) + |
| 43 " -L" + rebase_path(root_build_dir + "/obj/third_party/libevent") + |
| 44 " -l" + static_library_name + |
| 45 " -lstdc++ -lpthread -lm -lglib-2.0 -levent", |
| 46 "test", "-c", |
| 47 ] + rebase_path(invoker.sources, build_dir) |
| 48 } |
| 49 } |
OLD | NEW |