Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 declare_args() { | 5 declare_args() { |
| 6 # By default, there is no go build tool, because go builds are not supported. | 6 # By default, there is no go build tool, because go builds are not supported. |
| 7 go_build_tool = "" | 7 go_build_tool = "" |
| 8 } | 8 } |
| 9 | 9 |
| 10 # Declare a go test binary target. | 10 # Declare a go test binary target. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 rebase_path(target_out_dir, root_build_dir) + "/${target_name}", | 52 rebase_path(target_out_dir, root_build_dir) + "/${target_name}", |
| 53 rebase_path("//", root_build_dir), | 53 rebase_path("//", root_build_dir), |
| 54 "-I" + rebase_path("//"), | 54 "-I" + rebase_path("//"), |
| 55 " -L" + rebase_path(target_out_dir) + | 55 " -L" + rebase_path(target_out_dir) + |
| 56 " -l" + static_library_name + | 56 " -l" + static_library_name + |
| 57 " -lstdc++ -lpthread -lm -lglib-2.0", | 57 " -lstdc++ -lpthread -lm -lglib-2.0", |
| 58 "test", "-c", | 58 "test", "-c", |
| 59 ] + rebase_path(invoker.sources, build_dir) | 59 ] + rebase_path(invoker.sources, build_dir) |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | |
| 63 template("go_shared_library") { | |
| 64 # Only available on linux for now. | |
|
jamesr
2014/10/29 00:07:27
did you mean to assert(is_linux) here ?
gauthamt
2014/10/29 00:22:25
Actually, it works only on android. Changed commen
| |
| 65 assert(defined(invoker.sources)) | |
| 66 assert(go_build_tool != "") | |
| 67 | |
| 68 static_library_name = target_name + "_static_library" | |
| 69 | |
| 70 static_library(static_library_name) { | |
| 71 complete_static_lib = true | |
| 72 deps = invoker.deps | |
| 73 } | |
| 74 | |
| 75 action(target_name) { | |
| 76 deps = [ | |
| 77 ":$static_library_name", | |
|
jamesr
2014/10/29 00:07:27
nit: for one entry lists we prefer one-line e.g.
gauthamt
2014/10/29 00:22:25
Done.
| |
| 78 ] | |
| 79 script = "//build/go/go.py" | |
| 80 outputs = [ "${target_out_dir}/${target_name}" ] | |
| 81 # Since go test does not permit specifying an output directory or output | |
| 82 # binary name, we create a temporary build directory, and the python | |
| 83 # script will later identify the output, copy it to the target location, | |
| 84 # and clean up the temporary build directory. | |
| 85 build_dir = "${target_out_dir}/${target_name}_build" | |
| 86 args = [ | |
| 87 "--", | |
| 88 "CGO_ENABLED=1 GOOS=android GOARCH=arm GOARM=7 ${go_build_tool}", | |
| 89 rebase_path(build_dir, root_build_dir), | |
| 90 rebase_path(target_out_dir, root_build_dir) + "/${target_name}", | |
| 91 rebase_path("//", root_build_dir), | |
| 92 "-I" + rebase_path("//"), | |
| 93 " -L" + rebase_path(target_out_dir) + | |
| 94 " -l" + static_library_name + "", | |
| 95 "build -ldflags=-shared", | |
| 96 ] + rebase_path(invoker.sources, build_dir) | |
| 97 } | |
| 98 } | |
| OLD | NEW |