| OLD | NEW |
| 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/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
| 6 import("//build/config/android/internal_rules.gni") | 6 import("//build/config/android/internal_rules.gni") |
| 7 import("//tools/grit/grit_rule.gni") | 7 import("//tools/grit/grit_rule.gni") |
| 8 | 8 |
| 9 assert(is_android) | 9 assert(is_android) |
| 10 | 10 |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 328 |
| 329 | 329 |
| 330 # Declare a target that generates localized strings.xml from a .grd file. | 330 # Declare a target that generates localized strings.xml from a .grd file. |
| 331 # | 331 # |
| 332 # If this target is included in the deps of an android resources/library/apk, | 332 # If this target is included in the deps of an android resources/library/apk, |
| 333 # the strings.xml will be included with that target. | 333 # the strings.xml will be included with that target. |
| 334 # | 334 # |
| 335 # Variables | 335 # Variables |
| 336 # deps: Specifies the dependencies of this target. | 336 # deps: Specifies the dependencies of this target. |
| 337 # grd_file: Path to the .grd file to generate strings.xml from. | 337 # grd_file: Path to the .grd file to generate strings.xml from. |
| 338 # outputs: Expected grit outputs (see grit rule). |
| 338 # | 339 # |
| 339 # Example | 340 # Example |
| 340 # java_strings_grd("foo_strings_grd") { | 341 # java_strings_grd("foo_strings_grd") { |
| 341 # grd_file = "foo_strings.grd" | 342 # grd_file = "foo_strings.grd" |
| 342 # } | 343 # } |
| 343 template("java_strings_grd") { | 344 template("java_strings_grd") { |
| 344 base_path = "$target_gen_dir/$target_name" | |
| 345 resources_zip = base_path + ".resources.zip" | |
| 346 | |
| 347 write_build_config("${target_name}__build_config") { | 345 write_build_config("${target_name}__build_config") { |
| 348 type = "android_resources" | 346 type = "android_resources" |
| 349 if (defined(invoker.deps)) { | 347 if (defined(invoker.deps)) { |
| 350 deps = invoker.deps | 348 deps = invoker.deps |
| 351 } | 349 } |
| 352 } | 350 } |
| 353 | 351 |
| 352 # Put grit files into this subdirectory of target_gen_dir. |
| 353 extra_output_path = target_name + "_grit_output" |
| 354 |
| 354 grit_target_name = "${target_name}__grit" | 355 grit_target_name = "${target_name}__grit" |
| 355 grit_output_dir = base_path + "_grit_output" | |
| 356 grit(grit_target_name) { | 356 grit(grit_target_name) { |
| 357 grit_flags = [ | 357 grit_flags = [ |
| 358 "-E", "ANDROID_JAVA_TAGGED_ONLY=false", | 358 "-E", "ANDROID_JAVA_TAGGED_ONLY=false", |
| 359 ] | 359 ] |
| 360 output_dir = grit_output_dir | 360 output_dir = "$target_gen_dir/$extra_output_path" |
| 361 resource_ids = "" | 361 resource_ids = "" |
| 362 source = invoker.grd_file | 362 source = invoker.grd_file |
| 363 # The grit rule expects files relative to target_gen_dir, but this rule |
| 364 # appends a suffix to that. This rebase will prepend extra_output_path to |
| 365 # each filename. |
| 366 outputs = rebase_path(invoker.outputs, ".", extra_output_path) |
| 363 } | 367 } |
| 364 | 368 |
| 365 # This needs to get outputs from grit's internal target, not the final | 369 # This needs to get outputs from grit's internal target, not the final |
| 366 # source_set. | 370 # source_set. |
| 367 generate_strings_outputs = get_target_outputs(":${grit_target_name}_grit") | 371 generate_strings_outputs = get_target_outputs(":${grit_target_name}_grit") |
| 368 | 372 |
| 369 zip("${target_name}__zip") { | 373 zip("${target_name}__zip") { |
| 370 base_dir = grit_output_dir | 374 base_dir = grit_output_dir |
| 371 inputs = generate_strings_outputs | 375 inputs = generate_strings_outputs |
| 372 output = resources_zip | 376 output = "${target_gen_dir}/${target_name}.resources.zip" |
| 373 } | 377 } |
| 374 | 378 |
| 375 group(target_name) { | 379 group(target_name) { |
| 376 deps = [ | 380 deps = [ |
| 377 ":${target_name}__build_config", | 381 ":${target_name}__build_config", |
| 378 ":${target_name}__zip", | 382 ":${target_name}__zip", |
| 379 ] | 383 ] |
| 380 } | 384 } |
| 381 } | 385 } |
| 382 | 386 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 | 442 |
| 439 if (defined(invoker.jar_excluded_patterns)) { | 443 if (defined(invoker.jar_excluded_patterns)) { |
| 440 jar_excluded_patterns = invoker.jar_excluded_patterns | 444 jar_excluded_patterns = invoker.jar_excluded_patterns |
| 441 } | 445 } |
| 442 | 446 |
| 443 if (defined(invoker.srcjar_deps)) { | 447 if (defined(invoker.srcjar_deps)) { |
| 444 srcjar_deps = invoker.srcjar_deps | 448 srcjar_deps = invoker.srcjar_deps |
| 445 } | 449 } |
| 446 } | 450 } |
| 447 } | 451 } |
| OLD | NEW |