Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: mojo/go/rules.gni

Issue 979693002: Specify inputs and testonly in Go GN rules (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
22 22
23 template("go_test_binary") { 23 template("go_test_binary") {
24 # Only available on linux for now. 24 # Only available on linux for now.
25 assert(is_linux) 25 assert(is_linux)
26 assert(defined(invoker.sources)) 26 assert(defined(invoker.sources))
27 assert(go_build_tool != "") 27 assert(go_build_tool != "")
28 28
29 static_library_name = target_name + "_static_library" 29 static_library_name = target_name + "_static_library"
30 30
31 static_library(static_library_name) { 31 static_library(static_library_name) {
32 testonly = true
32 sources = invoker.static_library_sources 33 sources = invoker.static_library_sources
33 deps = invoker.deps 34 deps = invoker.deps
34 complete_static_lib = true 35 complete_static_lib = true
35 } 36 }
36 37
37 action(target_name) { 38 action(target_name) {
39 testonly = true
38 deps = [ 40 deps = [
39 ":$static_library_name", 41 ":$static_library_name",
40 ] 42 ]
41 script = "//mojo/go/go.py" 43 script = "//mojo/go/go.py"
44 inputs = invoker.sources
42 outputs = [ 45 outputs = [
43 "${target_out_dir}/${target_name}", 46 "${target_out_dir}/${target_name}",
44 ] 47 ]
45 48
46 # Since go test does not permit specifying an output directory or output 49 # Since go test does not permit specifying an output directory or output
47 # binary name, we create a temporary build directory, and the python 50 # binary name, we create a temporary build directory, and the python
48 # script will later identify the output, copy it to the target location, 51 # script will later identify the output, copy it to the target location,
49 # and clean up the temporary build directory. 52 # and clean up the temporary build directory.
50 build_dir = "${target_out_dir}/${target_name}_build" 53 build_dir = "${target_out_dir}/${target_name}_build"
51 args = [ 54 args = [
(...skipping 23 matching lines...) Expand all
75 static_library(static_library_name) { 78 static_library(static_library_name) {
76 complete_static_lib = true 79 complete_static_lib = true
77 deps = invoker.deps 80 deps = invoker.deps
78 } 81 }
79 82
80 action(target_name) { 83 action(target_name) {
81 deps = [ 84 deps = [
82 ":$static_library_name", 85 ":$static_library_name",
83 ] 86 ]
84 script = "//mojo/go/go.py" 87 script = "//mojo/go/go.py"
88 inputs = invoker.sources
85 outputs = [ 89 outputs = [
86 "${target_out_dir}/${target_name}", 90 "${target_out_dir}/${target_name}",
87 ] 91 ]
88 92
89 # Since go test does not permit specifying an output directory or output 93 # Since go test does not permit specifying an output directory or output
90 # binary name, we create a temporary build directory, and the python 94 # binary name, we create a temporary build directory, and the python
91 # script will later identify the output, copy it to the target location, 95 # script will later identify the output, copy it to the target location,
92 # and clean up the temporary build directory. 96 # and clean up the temporary build directory.
93 build_dir = "${target_out_dir}/${target_name}_build" 97 build_dir = "${target_out_dir}/${target_name}_build"
94 args = [ 98 args = [
95 "--", 99 "--",
96 "CGO_ENABLED=1 GOOS=android GOARCH=arm GOARM=7 ${go_build_tool}", 100 "CGO_ENABLED=1 GOOS=android GOARCH=arm GOARM=7 ${go_build_tool}",
97 rebase_path(build_dir, root_build_dir), 101 rebase_path(build_dir, root_build_dir),
98 rebase_path(target_out_dir, root_build_dir) + "/${target_name}", 102 rebase_path(target_out_dir, root_build_dir) + "/${target_name}",
99 rebase_path("//", root_build_dir), 103 rebase_path("//", root_build_dir),
100 rebase_path(root_out_dir, root_build_dir), 104 rebase_path(root_out_dir, root_build_dir),
101 "-I" + rebase_path("//"), 105 "-I" + rebase_path("//"),
102 " -L" + rebase_path(target_out_dir) + " -l" + static_library_name + 106 " -L" + rebase_path(target_out_dir) + " -l" + static_library_name +
103 "", 107 "",
104 "build -ldflags=-shared", 108 "build -ldflags=-shared",
105 ] + rebase_path(invoker.sources, build_dir) 109 ] + rebase_path(invoker.sources, build_dir)
106 } 110 }
107 } 111 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698