| 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 base_path = "$target_gen_dir/$target_name" |
| 345 resources_zip = base_path + ".resources.zip" | 346 resources_zip = base_path + ".resources.zip" |
| 346 | 347 |
| 347 write_build_config("${target_name}__build_config") { | 348 write_build_config("${target_name}__build_config") { |
| 348 type = "android_resources" | 349 type = "android_resources" |
| 349 if (defined(invoker.deps)) { | 350 if (defined(invoker.deps)) { |
| 350 deps = invoker.deps | 351 deps = invoker.deps |
| 351 } | 352 } |
| 352 } | 353 } |
| 353 | 354 |
| 355 # Put grit files into this subdirectory of target_gen_dir. |
| 356 extra_output_path = target_name + "_grit_output" |
| 357 |
| 354 grit_target_name = "${target_name}__grit" | 358 grit_target_name = "${target_name}__grit" |
| 355 grit_output_dir = base_path + "_grit_output" | 359 grit_output_dir = "$target_gen_dir/$extra_output_path" |
| 356 grit(grit_target_name) { | 360 grit(grit_target_name) { |
| 357 grit_flags = [ | 361 grit_flags = [ |
| 358 "-E", "ANDROID_JAVA_TAGGED_ONLY=false", | 362 "-E", "ANDROID_JAVA_TAGGED_ONLY=false", |
| 359 ] | 363 ] |
| 360 output_dir = grit_output_dir | 364 output_dir = grit_output_dir |
| 361 resource_ids = "" | 365 resource_ids = "" |
| 362 source = invoker.grd_file | 366 source = invoker.grd_file |
| 367 # The grit rule expects files relative to target_gen_dir, but this rule |
| 368 # appends a suffix to that. This rebase will prepend extra_output_path to |
| 369 # each filename. |
| 370 outputs = rebase_path(invoker.outputs, ".", extra_output_path) |
| 363 } | 371 } |
| 364 | 372 |
| 365 # This needs to get outputs from grit's internal target, not the final | 373 # This needs to get outputs from grit's internal target, not the final |
| 366 # source_set. | 374 # source_set. |
| 367 generate_strings_outputs = get_target_outputs(":${grit_target_name}_grit") | 375 generate_strings_outputs = get_target_outputs(":${grit_target_name}_grit") |
| 368 | 376 |
| 369 zip("${target_name}__zip") { | 377 zip("${target_name}__zip") { |
| 370 base_dir = grit_output_dir | 378 base_dir = grit_output_dir |
| 371 inputs = generate_strings_outputs | 379 inputs = generate_strings_outputs |
| 372 output = resources_zip | 380 output = resources_zip |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 | 446 |
| 439 if (defined(invoker.jar_excluded_patterns)) { | 447 if (defined(invoker.jar_excluded_patterns)) { |
| 440 jar_excluded_patterns = invoker.jar_excluded_patterns | 448 jar_excluded_patterns = invoker.jar_excluded_patterns |
| 441 } | 449 } |
| 442 | 450 |
| 443 if (defined(invoker.srcjar_deps)) { | 451 if (defined(invoker.srcjar_deps)) { |
| 444 srcjar_deps = invoker.srcjar_deps | 452 srcjar_deps = invoker.srcjar_deps |
| 445 } | 453 } |
| 446 } | 454 } |
| 447 } | 455 } |
| OLD | NEW |