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

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

Issue 1444113003: GN: asset_location -> android_assets() for mojo_runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@html_viewer-assets
Patch Set: rebase Created 5 years 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 | « build/android/gyp/apkbuilder.py ('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("//build/toolchain/toolchain.gni") 5 import("//build/toolchain/toolchain.gni")
6 6
7 if (is_android) {
8 import("//build/config/android/rules.gni")
9 }
10
7 # Generate a binary Mojo application in a self-named directory. 11 # Generate a binary Mojo application in a self-named directory.
8 # Application resources are copied to a "resources" directory alongside the app. 12 # Application resources are copied to a "resources" directory alongside the app.
9 # The parameters of this template are those of a shared library. 13 # The parameters of this template are those of a shared library.
10 template("mojo_native_application") { 14 template("mojo_native_application") {
11 base_target_name = target_name 15 base_target_name = target_name
12 if (defined(invoker.output_name)) { 16 if (defined(invoker.output_name)) {
13 base_target_name = invoker.output_name 17 base_target_name = invoker.output_name
14 } 18 }
15 19
16 final_target_name = target_name 20 final_target_name = target_name
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 116 }
113 if (defined(invoker.public)) { 117 if (defined(invoker.public)) {
114 public = invoker.public 118 public = invoker.public
115 } 119 }
116 if (defined(invoker.sources)) { 120 if (defined(invoker.sources)) {
117 sources = invoker.sources 121 sources = invoker.sources
118 } 122 }
119 if (defined(invoker.testonly)) { 123 if (defined(invoker.testonly)) {
120 testonly = invoker.testonly 124 testonly = invoker.testonly
121 } 125 }
122
123 visibility = [ ":${final_target_name}" ]
124 } 126 }
125 127
126 copy(final_target_name) { 128 copy(final_target_name) {
127 if (defined(invoker.testonly)) { 129 forward_variables_from(invoker,
128 testonly = invoker.testonly 130 [
129 } 131 "testonly",
130 if (defined(invoker.visibility)) { 132 "visibility",
131 visibility = invoker.visibility 133 ])
132 }
133 deps = [ 134 deps = [
134 ":${library_target_name}", 135 ":${library_target_name}",
135 ] 136 ]
136 137
137 sources = [ 138 sources = [
138 "${root_shlib_dir}/${library_name}", 139 "${root_shlib_dir}/${library_name}",
139 ] 140 ]
140 outputs = [ 141 outputs = [
141 "${root_out_dir}/${base_target_name}/${output}", 142 "${root_out_dir}/${base_target_name}/${output}",
142 ] 143 ]
143 } 144 }
145
146 if (is_android) {
147 android_assets("${final_target_name}_assets") {
148 forward_variables_from(invoker, [ "testonly" ])
149 deps = [
150 ":${library_target_name}",
151 ]
152 if (defined(invoker.deps)) {
153 deps += invoker.deps
154 }
155 renaming_sources = [ "${root_shlib_dir}/${library_name}" ]
156 renaming_destinations = [ "${base_target_name}/${output}" ]
157 if (defined(invoker.resources)) {
158 renaming_sources += invoker.resources
159 renaming_destinations += process_file_template(
160 invoker.resources,
161 [ "$base_target_name/resources/{{source_file_part}}" ])
162 }
163 }
164 }
144 } else { 165 } else {
145 nexe_target_name = base_target_name + "_nexe" 166 nexe_target_name = base_target_name + "_nexe"
146 nexe_name = base_target_name + ".nexe" 167 nexe_name = base_target_name + ".nexe"
147 168
148 output = "${base_target_name}_${target_cpu}.nexe.mojo" 169 output = "${base_target_name}_${target_cpu}.nexe.mojo"
149 170
150 executable(nexe_target_name) { 171 executable(nexe_target_name) {
151 output_name = base_target_name 172 output_name = base_target_name
152 173
153 if (defined(invoker.cflags)) { 174 if (defined(invoker.cflags)) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 # input_so: the .so file to bundle 290 # input_so: the .so file to bundle
270 # input_dex_jar: the .dex.jar file to bundle 291 # input_dex_jar: the .dex.jar file to bundle
271 # deps / public_deps / data_deps (optional): 292 # deps / public_deps / data_deps (optional):
272 # Dependencies. The targets that generate the .so/jar inputs should be 293 # Dependencies. The targets that generate the .so/jar inputs should be
273 # listed in either deps or public_deps. 294 # listed in either deps or public_deps.
274 # output_name (optional): override for the output file name 295 # output_name (optional): override for the output file name
275 template("mojo_android_application") { 296 template("mojo_android_application") {
276 assert(defined(invoker.input_so)) 297 assert(defined(invoker.input_so))
277 assert(defined(invoker.input_dex_jar)) 298 assert(defined(invoker.input_dex_jar))
278 299
300 base_target_name = target_name
301 if (defined(invoker.output_name)) {
302 base_target_name = invoker.output_name
303 }
304
279 mojo_deps = [] 305 mojo_deps = []
280 if (defined(invoker.resources)) { 306 if (defined(invoker.resources)) {
281 base_target_name = target_name
282 if (defined(invoker.output_name)) {
283 base_target_name = invoker.output_name
284 }
285
286 copy_step_name = "${base_target_name}__copy_resources" 307 copy_step_name = "${base_target_name}__copy_resources"
287 copy(copy_step_name) { 308 copy(copy_step_name) {
288 sources = invoker.resources 309 sources = invoker.resources
289 outputs = [ 310 outputs = [
290 "${root_out_dir}/${base_target_name}/resources/{{source_file_part}}", 311 "${root_out_dir}/${base_target_name}/resources/{{source_file_part}}",
291 ] 312 ]
292 if (defined(invoker.testonly)) { 313 if (defined(invoker.testonly)) {
293 testonly = invoker.testonly 314 testonly = invoker.testonly
294 } 315 }
295 if (defined(invoker.deps)) { 316 if (defined(invoker.deps)) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 deps = invoker.deps 348 deps = invoker.deps
328 } 349 }
329 if (defined(invoker.public_deps)) { 350 if (defined(invoker.public_deps)) {
330 public_deps = invoker.public_deps 351 public_deps = invoker.public_deps
331 } 352 }
332 if (defined(invoker.data_deps)) { 353 if (defined(invoker.data_deps)) {
333 data_deps = invoker.data_deps 354 data_deps = invoker.data_deps
334 } 355 }
335 } 356 }
336 357
358 _mojo_output =
359 "${root_out_dir}/${base_target_name}/${base_target_name}.mojo"
360
337 action(target_name) { 361 action(target_name) {
338 script = "//mojo/public/tools/prepend.py" 362 script = "//mojo/public/tools/prepend.py"
339 363
340 base_target_name = target_name
341 if (defined(invoker.output_name)) {
342 base_target_name = invoker.output_name
343 }
344
345 input = zip_action_output 364 input = zip_action_output
346 inputs = [ 365 inputs = [
347 input, 366 input,
348 ] 367 ]
349 368
350 output = "${root_out_dir}/${base_target_name}/${base_target_name}.mojo"
351 outputs = [ 369 outputs = [
352 output, 370 _mojo_output,
353 ] 371 ]
354 372
355 rebase_input = rebase_path(input, root_build_dir) 373 rebase_input = rebase_path(input, root_build_dir)
356 rebase_output = rebase_path(output, root_build_dir) 374 rebase_output = rebase_path(_mojo_output, root_build_dir)
357 args = [ 375 args = [
358 "--input=$rebase_input", 376 "--input=$rebase_input",
359 "--output=$rebase_output", 377 "--output=$rebase_output",
360 "--line=#!mojo mojo:android_handler", 378 "--line=#!mojo mojo:android_handler",
361 ] 379 ]
362 380
363 deps = mojo_deps 381 deps = mojo_deps
364 382
365 public_deps = [ 383 public_deps = [
366 ":$zip_action_name", 384 ":$zip_action_name",
367 ] 385 ]
368 } 386 }
387
388 android_assets("${target_name}_assets") {
389 forward_variables_from(invoker, [ "testonly" ])
390 deps = [
391 ":$prepend_action_name",
392 ]
393 renaming_sources = [ _mojo_output ]
394 renaming_destinations = [ "${base_target_name}/${base_target_name}.mojo" ]
395 if (defined(invoker.resources)) {
396 renaming_sources += invoker.resources
397 renaming_destinations += process_file_template(
398 invoker.resources,
399 [ "$base_target_name/resources/{{source_file_part}}" ])
400 }
401 }
369 } 402 }
370 } 403 }
OLDNEW
« no previous file with comments | « build/android/gyp/apkbuilder.py ('k') | mojo/runner/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698