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

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: Created 5 years, 1 month 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
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 =
157 [ "${base_target_name}/${base_target_name}.mojo" ]
pkotwicz 2015/11/17 19:34:25 Nit: ${base_target_name}.mojo -> ${output}
agrieve 2015/11/21 01:47:26 Done.
158 if (defined(invoker.resources)) {
159 renaming_sources += invoker.resources
160 renaming_destinations += process_file_template(
161 invoker.resources,
162 [ "$base_target_name/resources/{{source_file_part}}" ])
163 }
164 }
165 }
144 } else { 166 } else {
145 nexe_target_name = base_target_name + "_nexe" 167 nexe_target_name = base_target_name + "_nexe"
146 nexe_name = base_target_name + ".nexe" 168 nexe_name = base_target_name + ".nexe"
147 169
148 output = "${base_target_name}_${target_cpu}.nexe.mojo" 170 output = "${base_target_name}_${target_cpu}.nexe.mojo"
149 171
150 executable(nexe_target_name) { 172 executable(nexe_target_name) {
151 output_name = base_target_name 173 output_name = base_target_name
152 174
153 if (defined(invoker.cflags)) { 175 if (defined(invoker.cflags)) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 # input_so: the .so file to bundle 291 # input_so: the .so file to bundle
270 # input_dex_jar: the .dex.jar file to bundle 292 # input_dex_jar: the .dex.jar file to bundle
271 # deps / public_deps / data_deps (optional): 293 # deps / public_deps / data_deps (optional):
272 # Dependencies. The targets that generate the .so/jar inputs should be 294 # Dependencies. The targets that generate the .so/jar inputs should be
273 # listed in either deps or public_deps. 295 # listed in either deps or public_deps.
274 # output_name (optional): override for the output file name 296 # output_name (optional): override for the output file name
275 template("mojo_android_application") { 297 template("mojo_android_application") {
276 assert(defined(invoker.input_so)) 298 assert(defined(invoker.input_so))
277 assert(defined(invoker.input_dex_jar)) 299 assert(defined(invoker.input_dex_jar))
278 300
301 base_target_name = target_name
302 if (defined(invoker.output_name)) {
303 base_target_name = invoker.output_name
304 }
305
279 mojo_deps = [] 306 mojo_deps = []
280 if (defined(invoker.resources)) { 307 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" 308 copy_step_name = "${base_target_name}__copy_resources"
287 copy(copy_step_name) { 309 copy(copy_step_name) {
288 sources = invoker.resources 310 sources = invoker.resources
289 outputs = [ 311 outputs = [
290 "${root_out_dir}/${base_target_name}/resources/{{source_file_part}}", 312 "${root_out_dir}/${base_target_name}/resources/{{source_file_part}}",
291 ] 313 ]
292 if (defined(invoker.testonly)) { 314 if (defined(invoker.testonly)) {
293 testonly = invoker.testonly 315 testonly = invoker.testonly
294 } 316 }
295 if (defined(invoker.deps)) { 317 if (defined(invoker.deps)) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 deps = invoker.deps 349 deps = invoker.deps
328 } 350 }
329 if (defined(invoker.public_deps)) { 351 if (defined(invoker.public_deps)) {
330 public_deps = invoker.public_deps 352 public_deps = invoker.public_deps
331 } 353 }
332 if (defined(invoker.data_deps)) { 354 if (defined(invoker.data_deps)) {
333 data_deps = invoker.data_deps 355 data_deps = invoker.data_deps
334 } 356 }
335 } 357 }
336 358
359 _mojo_output =
360 "${root_out_dir}/${base_target_name}/${base_target_name}.mojo"
361
337 action(target_name) { 362 action(target_name) {
338 script = "//mojo/public/tools/prepend.py" 363 script = "//mojo/public/tools/prepend.py"
339 364
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 365 input = zip_action_output
346 inputs = [ 366 inputs = [
347 input, 367 input,
348 ] 368 ]
349 369
350 output = "${root_out_dir}/${base_target_name}/${base_target_name}.mojo"
351 outputs = [ 370 outputs = [
352 output, 371 _mojo_output,
353 ] 372 ]
354 373
355 rebase_input = rebase_path(input, root_build_dir) 374 rebase_input = rebase_path(input, root_build_dir)
356 rebase_output = rebase_path(output, root_build_dir) 375 rebase_output = rebase_path(_mojo_output, root_build_dir)
357 args = [ 376 args = [
358 "--input=$rebase_input", 377 "--input=$rebase_input",
359 "--output=$rebase_output", 378 "--output=$rebase_output",
360 "--line=#!mojo mojo:android_handler", 379 "--line=#!mojo mojo:android_handler",
361 ] 380 ]
362 381
363 deps = mojo_deps 382 deps = mojo_deps
364 383
365 public_deps = [ 384 public_deps = [
366 ":$zip_action_name", 385 ":$zip_action_name",
367 ] 386 ]
368 } 387 }
388
389 android_assets("${target_name}_assets") {
390 forward_variables_from(invoker, [ "testonly" ])
391 deps = [
392 ":$prepend_action_name",
393 ]
394 renaming_sources = [ _mojo_output ]
395 renaming_destinations = [ "${base_target_name}/${base_target_name}.mojo" ]
396 if (defined(invoker.resources)) {
397 renaming_sources += invoker.resources
398 renaming_destinations += process_file_template(
399 invoker.resources,
400 [ "$base_target_name/resources/{{source_file_part}}" ])
401 }
402 }
369 } 403 }
370 } 404 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698