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("//base/android/linker/config.gni") | 5 import("//base/android/linker/config.gni") |
6 import("//build/config/android/config.gni") | 6 import("//build/config/android/config.gni") |
7 import("//build/config/android/internal_rules.gni") | 7 import("//build/config/android/internal_rules.gni") |
8 import("//third_party/android_platform/config.gni") | 8 import("//third_party/android_platform/config.gni") |
9 import("//tools/grit/grit_rule.gni") | 9 import("//tools/grit/grit_rule.gni") |
10 | 10 |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 } | 537 } |
538 | 538 |
539 group(target_name) { | 539 group(target_name) { |
540 deps = [ | 540 deps = [ |
541 ":${target_name}__build_config", | 541 ":${target_name}__build_config", |
542 ":${target_name}__template", | 542 ":${target_name}__template", |
543 ] | 543 ] |
544 } | 544 } |
545 } | 545 } |
546 | 546 |
| 547 # Creates a resources.zip with locale.pak files placed into appropriate |
| 548 # resource configs (e.g. en-GB.pak -> res/raw-en/en_gb.pak). Also generates |
| 549 # a locale_paks TypedArray so that resource files can be enumerated at runtime. |
| 550 # |
| 551 # If this target is included in the deps of an android resources/library/apk, |
| 552 # the resources will be included with that target. |
| 553 # |
| 554 # Variables: |
| 555 # sources: List of .pak files. Names must be of the form "en.pak" or |
| 556 # "en-US.pak". |
| 557 # |
| 558 # Example |
| 559 # locale_pak_resources("locale_paks") { |
| 560 # sources = [ "path/en-US.pak", "path/fr.pak", ... ] |
| 561 # } |
| 562 template("locale_pak_resources") { |
| 563 set_sources_assignment_filter([]) |
| 564 assert(defined(invoker.sources)) |
| 565 |
| 566 _base_path = "$target_gen_dir/$target_name" |
| 567 _resources_zip = _base_path + ".resources.zip" |
| 568 _build_config = _base_path + ".build_config" |
| 569 |
| 570 write_build_config("${target_name}__build_config") { |
| 571 build_config = _build_config |
| 572 resources_zip = _resources_zip |
| 573 type = "android_resources" |
| 574 } |
| 575 |
| 576 action("${target_name}__create_resources_zip") { |
| 577 sources = invoker.sources |
| 578 script = "//build/android/gyp/locale_pak_resources.py" |
| 579 depfile = "$target_gen_dir/$target_name.d" |
| 580 |
| 581 outputs = [ |
| 582 depfile, |
| 583 _resources_zip, |
| 584 ] |
| 585 |
| 586 _rebased_sources = rebase_path(invoker.sources, root_build_dir) |
| 587 args = [ |
| 588 "--locale-paks=${_rebased_sources}", |
| 589 "--resources-zip", |
| 590 rebase_path(_resources_zip, root_build_dir), |
| 591 "--depfile", |
| 592 rebase_path(depfile, root_build_dir), |
| 593 ] |
| 594 } |
| 595 |
| 596 group(target_name) { |
| 597 deps = [ |
| 598 ":${target_name}__build_config", |
| 599 ":${target_name}__create_resources_zip", |
| 600 ] |
| 601 } |
| 602 } |
| 603 |
547 # Declare an Android resources target | 604 # Declare an Android resources target |
548 # | 605 # |
549 # This creates a resources zip file that will be used when building an Android | 606 # This creates a resources zip file that will be used when building an Android |
550 # library or apk and included into a final apk. | 607 # library or apk and included into a final apk. |
551 # | 608 # |
552 # To include these resources in a library/apk, this target should be listed in | 609 # To include these resources in a library/apk, this target should be listed in |
553 # the library's deps. A library/apk will also include any resources used by its | 610 # the library's deps. A library/apk will also include any resources used by its |
554 # own dependencies. | 611 # own dependencies. |
555 # | 612 # |
556 # Variables | 613 # Variables |
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 template("uiautomator_test") { | 2175 template("uiautomator_test") { |
2119 set_sources_assignment_filter([]) | 2176 set_sources_assignment_filter([]) |
2120 if (defined(invoker.testonly)) { | 2177 if (defined(invoker.testonly)) { |
2121 testonly = invoker.testonly | 2178 testonly = invoker.testonly |
2122 } | 2179 } |
2123 assert(target_name != "") | 2180 assert(target_name != "") |
2124 assert(invoker.deps != [] || true) | 2181 assert(invoker.deps != [] || true) |
2125 group(target_name) { | 2182 group(target_name) { |
2126 } | 2183 } |
2127 } | 2184 } |
OLD | NEW |