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

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

Issue 1378993002: Adds new GN template go_binary (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 2 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 library. 10 # Declare a go library.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 rebase_path(root_out_dir, root_build_dir), 84 rebase_path(root_out_dir, root_build_dir),
85 "-I" + rebase_path("//"), 85 "-I" + rebase_path("//"),
86 "-L" + rebase_path(target_out_dir) + " -l" + static_library_name + 86 "-L" + rebase_path(target_out_dir) + " -l" + static_library_name +
87 " -lstdc++ -lpthread -lm -lglib-2.0 -lrt", 87 " -lstdc++ -lpthread -lm -lglib-2.0 -lrt",
88 "test", 88 "test",
89 "-c", 89 "-c",
90 ] + rebase_path(invoker.sources, build_dir) 90 ] + rebase_path(invoker.sources, build_dir)
91 } 91 }
92 } 92 }
93 93
94 template("go_application") {
rogulenko 2015/10/01 18:48:07 My high level question is how are you going to use
rudominer 2015/10/02 16:36:00 I plan to use this to build the new version of the
95 assert(is_android || is_linux)
96 assert(defined(invoker.sources))
97 assert(defined(invoker.deps))
98 assert(defined(invoker.static_library_sources))
99 assert(go_build_tool != "")
100
101 static_library_name = target_name + "_static_library"
102 static_library(static_library_name) {
103 complete_static_lib = true
104 sources = invoker.static_library_sources
105 deps = invoker.deps
106 }
107
108 go_binary_name = target_name + "_go"
109 action(go_binary_name) {
110 deps = invoker.deps + [ ":${static_library_name}" ]
111 script = "//mojo/go/go.py"
112 inputs = invoker.sources
113 outputs = [
114 "${target_out_dir}/${target_name}",
115 ]
116
117 # Since go build does not permit specifying an output directory or output
118 # binary name, we create a temporary build directory, and the python
119 # script will later identify the output, copy it to the target location,
120 # and clean up the temporary build directory.
121 build_dir = "${target_out_dir}/${target_name}_build"
122 args = []
123 if (is_android) {
124 args += [ "--android" ]
125 }
126 args += [
127 "--",
128 "${go_build_tool}",
129 rebase_path(build_dir, root_build_dir),
130 rebase_path(target_out_dir, root_build_dir) + "/${target_name}",
131 rebase_path("//", root_build_dir),
132 rebase_path(root_out_dir, root_build_dir),
133 "-I" + rebase_path("//"),
134 "-L" + rebase_path(target_out_dir) + " -l" + static_library_name + "",
135 "build",
136 ]
137 args += rebase_path(invoker.sources, build_dir)
138 }
139
140 copy(target_name) {
141 deps = [
142 ":${go_binary_name}",
143 ]
144 sources = [
145 "${target_out_dir}/${go_binary_name}",
146 ]
147 outputs = [
148 "${root_out_dir}/${target_name}",
149 ]
150 }
151 }
152
94 template("go_mojo_application") { 153 template("go_mojo_application") {
95 assert(is_android || is_linux) 154 assert(is_android || is_linux)
96 assert(defined(invoker.sources)) 155 assert(defined(invoker.sources))
97 assert(go_build_tool != "") 156 assert(go_build_tool != "")
98 157
99 static_library_name = target_name + "_static_library" 158 static_library_name = target_name + "_static_library"
100 static_library(static_library_name) { 159 static_library(static_library_name) {
101 complete_static_lib = true 160 complete_static_lib = true
102 deps = [ 161 deps = [
103 "//mojo/public/platform/native:system", 162 "//mojo/public/platform/native:system",
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 ":${go_library_name}", 206 ":${go_library_name}",
148 ] 207 ]
149 sources = [ 208 sources = [
150 "${target_out_dir}/${go_library_name}", 209 "${target_out_dir}/${go_library_name}",
151 ] 210 ]
152 outputs = [ 211 outputs = [
153 "${root_out_dir}/${target_name}.mojo", 212 "${root_out_dir}/${target_name}.mojo",
154 ] 213 ]
155 } 214 }
156 } 215 }
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