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

Side by Side Diff: mojo/public/mojo_application.gni

Issue 1189703004: Reland: Build Mojo apps in sub-dirs, like application packages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup, move getAssetsList to FileHelper; rename local to cached. Created 5 years, 6 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 | « mojo/mojo_application_package.gni ('k') | mojo/runner/BUILD.gn » ('j') | 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 import("mojo.gni") 5 import("mojo.gni")
6 6
7 # Generate a binary mojo application.The parameters of this template are those 7 # Generate a binary Mojo application in a self-named directory.
8 # of a shared library. 8 # Application resources are copied to a "resources" directory alongside the app.
9 # The parameters of this template are those of a shared library.
9 template("mojo_native_application") { 10 template("mojo_native_application") {
11 base_target_name = target_name
10 if (defined(invoker.output_name)) { 12 if (defined(invoker.output_name)) {
11 base_target_name = invoker.output_name 13 base_target_name = invoker.output_name
12 } else {
13 base_target_name = target_name
14 } 14 }
15 15
16 final_target_name = target_name 16 final_target_name = target_name
17 17
18 mojo_deps = []
19 if (defined(invoker.deps)) {
20 mojo_deps += invoker.deps
21 }
22
23 if (defined(invoker.resources)) {
24 copy_step_name = "${base_target_name}__copy_resources"
25 copy(copy_step_name) {
26 sources = invoker.resources
27 outputs = [
28 "${root_out_dir}/${base_target_name}/resources/{{source_file_part}}",
29 ]
30 if (defined(invoker.testonly)) {
31 testonly = invoker.testonly
32 }
33 deps = mojo_deps
34 }
35 mojo_deps += [ ":$copy_step_name" ]
36 }
37
18 if (!is_nacl) { 38 if (!is_nacl) {
19 output = base_target_name + ".mojo" 39 output = base_target_name + ".mojo"
20 library_target_name = base_target_name + "_library" 40 library_target_name = base_target_name + "_library"
21 41
22 if (is_linux || is_android) { 42 if (is_linux || is_android) {
23 library_name = "lib${library_target_name}.so" 43 library_name = "lib${library_target_name}.so"
24 } else if (is_win) { 44 } else if (is_win) {
25 library_name = "${library_target_name}.dll" 45 library_name = "${library_target_name}.dll"
26 } else if (is_mac) { 46 } else if (is_mac) {
27 library_name = "lib${library_target_name}.dylib" 47 library_name = "lib${library_target_name}.dylib"
28 } else { 48 } else {
29 assert(false, "Platform not supported.") 49 assert(false, "Platform not supported.")
30 } 50 }
31 51
32 if (is_android) { 52 if (is_android) {
33 # On android, use the stripped version of the library, because application s 53 # On android, use the stripped version of the library, because
34 # are always fetched over the network. 54 # applications are always fetched over the network.
35 library_dir = "${root_out_dir}/lib.stripped" 55 library_dir = "${root_out_dir}/lib.stripped"
36 } else { 56 } else {
37 library_dir = root_out_dir 57 library_dir = root_out_dir
38 } 58 }
39 59
40 shared_library(library_target_name) { 60 shared_library(library_target_name) {
41 if (defined(invoker.cflags)) { 61 if (defined(invoker.cflags)) {
42 cflags = invoker.cflags 62 cflags = invoker.cflags
43 } 63 }
44 if (defined(invoker.cflags_c)) { 64 if (defined(invoker.cflags_c)) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 ".", 104 ".",
85 mojo_root) ] 105 mojo_root) ]
86 } 106 }
87 107
88 deps = rebase_path([ 108 deps = rebase_path([
89 "mojo/public/c/system", 109 "mojo/public/c/system",
90 "mojo/public/platform/native:system", 110 "mojo/public/platform/native:system",
91 ], 111 ],
92 ".", 112 ".",
93 mojo_root) 113 mojo_root)
94 if (defined(invoker.deps)) { 114 deps += mojo_deps
95 deps += invoker.deps
96 }
97 if (defined(invoker.forward_dependent_configs_from)) { 115 if (defined(invoker.forward_dependent_configs_from)) {
98 forward_dependent_configs_from = invoker.forward_dependent_configs_from 116 forward_dependent_configs_from = invoker.forward_dependent_configs_from
99 } 117 }
100 if (defined(invoker.public_deps)) { 118 if (defined(invoker.public_deps)) {
101 public_deps = invoker.public_deps 119 public_deps = invoker.public_deps
102 } 120 }
103 if (defined(invoker.all_dependent_configs)) { 121 if (defined(invoker.all_dependent_configs)) {
104 all_dependent_configs = invoker.all_dependent_configs 122 all_dependent_configs = invoker.all_dependent_configs
105 } 123 }
106 if (defined(invoker.public_configs)) { 124 if (defined(invoker.public_configs)) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 visibility = invoker.visibility 157 visibility = invoker.visibility
140 } 158 }
141 deps = [ 159 deps = [
142 ":${library_target_name}", 160 ":${library_target_name}",
143 ] 161 ]
144 162
145 sources = [ 163 sources = [
146 "${library_dir}/${library_name}", 164 "${library_dir}/${library_name}",
147 ] 165 ]
148 outputs = [ 166 outputs = [
149 "${root_out_dir}/${output}", 167 "${root_out_dir}/${base_target_name}/${output}",
150 ] 168 ]
151 } 169 }
152 } else { 170 } else {
153 nexe_target_name = base_target_name + "_nexe" 171 nexe_target_name = base_target_name + "_nexe"
154 nexe_name = base_target_name + ".nexe" 172 nexe_name = base_target_name + ".nexe"
155 173
156 output = "${base_target_name}_${target_cpu}.nexe.mojo" 174 output = "${base_target_name}_${target_cpu}.nexe.mojo"
157 175
158 executable(nexe_target_name) { 176 executable(nexe_target_name) {
159 output_name = base_target_name 177 output_name = base_target_name
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 ".", 222 ".",
205 mojo_root) ] 223 mojo_root) ]
206 } 224 }
207 225
208 deps = rebase_path([ 226 deps = rebase_path([
209 "mojo/public/c/system", 227 "mojo/public/c/system",
210 "mojo/public/platform/nacl:system", 228 "mojo/public/platform/nacl:system",
211 ], 229 ],
212 ".", 230 ".",
213 mojo_root) 231 mojo_root)
214 if (defined(invoker.deps)) { 232 deps += mojo_deps
215 deps += invoker.deps
216 }
217 if (defined(invoker.forward_dependent_configs_from)) { 233 if (defined(invoker.forward_dependent_configs_from)) {
218 forward_dependent_configs_from = invoker.forward_dependent_configs_from 234 forward_dependent_configs_from = invoker.forward_dependent_configs_from
219 } 235 }
220 if (defined(invoker.public_deps)) { 236 if (defined(invoker.public_deps)) {
221 public_deps = invoker.public_deps 237 public_deps = invoker.public_deps
222 } 238 }
223 if (defined(invoker.all_dependent_configs)) { 239 if (defined(invoker.all_dependent_configs)) {
224 all_dependent_configs = invoker.all_dependent_configs 240 all_dependent_configs = invoker.all_dependent_configs
225 } 241 }
226 if (defined(invoker.public_configs)) { 242 if (defined(invoker.public_configs)) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 visibility = invoker.visibility 275 visibility = invoker.visibility
260 } 276 }
261 277
262 script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_root) 278 script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_root)
263 279
264 input_path = "${root_out_dir}/${nexe_name}" 280 input_path = "${root_out_dir}/${nexe_name}"
265 inputs = [ 281 inputs = [
266 input_path, 282 input_path,
267 ] 283 ]
268 284
269 output_path = "${root_build_dir}/${output}" 285 output_path = "${root_build_dir}/${base_target_name}/${output}"
270 outputs = [ 286 outputs = [
271 output_path, 287 output_path,
272 ] 288 ]
273 289
274 deps = [ 290 deps = [
275 ":${nexe_target_name}", 291 ":${nexe_target_name}",
276 ] 292 ]
277 293
278 rebase_input = rebase_path(input_path, root_build_dir) 294 rebase_input = rebase_path(input_path, root_build_dir)
279 rebase_output = rebase_path(output_path, root_build_dir) 295 rebase_output = rebase_path(output_path, root_build_dir)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 deps = invoker.deps 345 deps = invoker.deps
330 } 346 }
331 if (defined(invoker.public_deps)) { 347 if (defined(invoker.public_deps)) {
332 public_deps = invoker.public_deps 348 public_deps = invoker.public_deps
333 } 349 }
334 if (defined(invoker.data_deps)) { 350 if (defined(invoker.data_deps)) {
335 data_deps = invoker.data_deps 351 data_deps = invoker.data_deps
336 } 352 }
337 } 353 }
338 354
339 if (defined(invoker.output_name)) {
340 mojo_output = "$root_out_dir/" + invoker.output_name + ".mojo"
341 } else {
342 mojo_output = "$root_out_dir/" + target_name + ".mojo"
343 }
344
345 action(target_name) { 355 action(target_name) {
346 script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_root) 356 script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_root)
347 357
358 base_target_name = target_name
359 if (defined(invoker.output_name)) {
360 base_target_name = invoker.output_name
361 }
362
348 input = zip_action_output 363 input = zip_action_output
349 inputs = [ 364 inputs = [
350 input, 365 input,
351 ] 366 ]
352 367
353 output = mojo_output 368 output = "${root_out_dir}/${base_target_name}/${base_target_name}.mojo"
354 outputs = [ 369 outputs = [
355 output, 370 output,
356 ] 371 ]
357 372
358 rebase_input = rebase_path(input, root_build_dir) 373 rebase_input = rebase_path(input, root_build_dir)
359 rebase_output = rebase_path(output, root_build_dir) 374 rebase_output = rebase_path(output, root_build_dir)
360 args = [ 375 args = [
361 "--input=$rebase_input", 376 "--input=$rebase_input",
362 "--output=$rebase_output", 377 "--output=$rebase_output",
363 "--line=#!mojo mojo:android_handler", 378 "--line=#!mojo mojo:android_handler",
364 ] 379 ]
365 380
366 public_deps = [ 381 public_deps = [
367 ":$zip_action_name", 382 ":$zip_action_name",
368 ] 383 ]
369 } 384 }
370 } 385 }
371 } 386 }
OLDNEW
« no previous file with comments | « mojo/mojo_application_package.gni ('k') | mojo/runner/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698