| 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 # Do not add any imports to non-//build directories here. | 5 # Do not add any imports to non-//build directories here. |
| 6 # Some projects (e.g. V8) do not have non-build directories DEPS'ed in. | 6 # Some projects (e.g. V8) do not have non-build directories DEPS'ed in. |
| 7 import("//build/config/android/config.gni") | 7 import("//build/config/android/config.gni") |
| 8 import("//build/config/android/internal_rules.gni") | 8 import("//build/config/android/internal_rules.gni") |
| 9 import("//build/config/dcheck_always_on.gni") | 9 import("//build/config/dcheck_always_on.gni") |
| 10 import("//build/toolchain/toolchain.gni") | 10 import("//build/toolchain/toolchain.gni") |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 } | 600 } |
| 601 | 601 |
| 602 group(target_name) { | 602 group(target_name) { |
| 603 public_deps = [ | 603 public_deps = [ |
| 604 ":${target_name}__build_config", | 604 ":${target_name}__build_config", |
| 605 ":${target_name}__template", | 605 ":${target_name}__template", |
| 606 ] | 606 ] |
| 607 } | 607 } |
| 608 } | 608 } |
| 609 | 609 |
| 610 # Creates a resources.zip with locale.pak files placed into appropriate | |
| 611 # resource configs (e.g. en-GB.pak -> res/raw-en/en_gb.pak). Also generates | |
| 612 # a locale_paks TypedArray so that resource files can be enumerated at runtime
. | |
| 613 # | |
| 614 # If this target is included in the deps of an android resources/library/apk, | |
| 615 # the resources will be included with that target. | |
| 616 # | |
| 617 # Variables: | |
| 618 # sources: List of .pak files. Names must be of the form "en.pak" or | |
| 619 # "en-US.pak". | |
| 620 # deps: (optional) List of dependencies that might be needed to generate | |
| 621 # the .pak files. | |
| 622 # | |
| 623 # Example | |
| 624 # locale_pak_resources("locale_paks") { | |
| 625 # sources = [ "path/en-US.pak", "path/fr.pak", ... ] | |
| 626 # } | |
| 627 template("locale_pak_resources") { | |
| 628 set_sources_assignment_filter([]) | |
| 629 assert(defined(invoker.sources)) | |
| 630 | |
| 631 _base_path = "$target_gen_dir/$target_name" | |
| 632 _resources_zip = _base_path + ".resources.zip" | |
| 633 _build_config = _base_path + ".build_config" | |
| 634 | |
| 635 write_build_config("${target_name}__build_config") { | |
| 636 build_config = _build_config | |
| 637 resources_zip = _resources_zip | |
| 638 type = "android_resources" | |
| 639 is_locale_resource = true | |
| 640 } | |
| 641 | |
| 642 action("${target_name}__create_resources_zip") { | |
| 643 forward_variables_from(invoker, | |
| 644 [ | |
| 645 "deps", | |
| 646 "sources", | |
| 647 ]) | |
| 648 script = "//build/android/gyp/locale_pak_resources.py" | |
| 649 depfile = "$target_gen_dir/$target_name.d" | |
| 650 | |
| 651 outputs = [ | |
| 652 _resources_zip, | |
| 653 ] | |
| 654 | |
| 655 _rebased_sources = rebase_path(sources, root_build_dir) | |
| 656 args = [ | |
| 657 "--locale-paks=${_rebased_sources}", | |
| 658 "--resources-zip", | |
| 659 rebase_path(_resources_zip, root_build_dir), | |
| 660 "--depfile", | |
| 661 rebase_path(depfile, root_build_dir), | |
| 662 ] | |
| 663 } | |
| 664 | |
| 665 group(target_name) { | |
| 666 public_deps = [ | |
| 667 ":${target_name}__build_config", | |
| 668 ":${target_name}__create_resources_zip", | |
| 669 ] | |
| 670 } | |
| 671 } | |
| 672 | |
| 673 # Declare an Android resources target | 610 # Declare an Android resources target |
| 674 # | 611 # |
| 675 # This creates a resources zip file that will be used when building an Android | 612 # This creates a resources zip file that will be used when building an Android |
| 676 # library or apk and included into a final apk. | 613 # library or apk and included into a final apk. |
| 677 # | 614 # |
| 678 # To include these resources in a library/apk, this target should be listed in | 615 # To include these resources in a library/apk, this target should be listed in |
| 679 # the library's deps. A library/apk will also include any resources used by it
s | 616 # the library's deps. A library/apk will also include any resources used by it
s |
| 680 # own dependencies. | 617 # own dependencies. |
| 681 # | 618 # |
| 682 # Variables | 619 # Variables |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 set_sources_assignment_filter([]) | 780 set_sources_assignment_filter([]) |
| 844 forward_variables_from(invoker, [ "testonly" ]) | 781 forward_variables_from(invoker, [ "testonly" ]) |
| 845 | 782 |
| 846 _build_config = "$target_gen_dir/$target_name.build_config" | 783 _build_config = "$target_gen_dir/$target_name.build_config" |
| 847 _build_config_target_name = "${target_name}__build_config" | 784 _build_config_target_name = "${target_name}__build_config" |
| 848 | 785 |
| 849 write_build_config(_build_config_target_name) { | 786 write_build_config(_build_config_target_name) { |
| 850 type = "android_assets" | 787 type = "android_assets" |
| 851 build_config = _build_config | 788 build_config = _build_config |
| 852 | 789 |
| 853 forward_variables_from(invoker, [ "disable_compression" ]) | 790 forward_variables_from(invoker, |
| 791 [ |
| 792 "disable_compression", |
| 793 "is_locale_asset", |
| 794 ]) |
| 854 | 795 |
| 855 if (defined(invoker.deps)) { | 796 if (defined(invoker.deps)) { |
| 856 possible_config_deps = invoker.deps | 797 possible_config_deps = invoker.deps |
| 857 } | 798 } |
| 858 | 799 |
| 859 if (defined(invoker.sources)) { | 800 if (defined(invoker.sources)) { |
| 860 asset_sources = invoker.sources | 801 asset_sources = invoker.sources |
| 861 } | 802 } |
| 862 if (defined(invoker.renaming_sources)) { | 803 if (defined(invoker.renaming_sources)) { |
| 863 assert(defined(invoker.renaming_destinations)) | 804 assert(defined(invoker.renaming_destinations)) |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 # "*/FooService.class", "*/FooService\$*.class" | 1143 # "*/FooService.class", "*/FooService\$*.class" |
| 1203 # ] | 1144 # ] |
| 1204 # } | 1145 # } |
| 1205 template("java_library") { | 1146 template("java_library") { |
| 1206 set_sources_assignment_filter([]) | 1147 set_sources_assignment_filter([]) |
| 1207 java_library_impl(target_name) { | 1148 java_library_impl(target_name) { |
| 1208 forward_variables_from(invoker, "*") | 1149 forward_variables_from(invoker, "*") |
| 1209 } | 1150 } |
| 1210 } | 1151 } |
| 1211 | 1152 |
| 1153 # Creates android assets for locale pak files and a srcjar with a java class |
| 1154 # containing the pak file paths so that they can be extracted as necessary. |
| 1155 # |
| 1156 # Variables: |
| 1157 # sources: List of .pak files. Names must be of the form "en.pak" or |
| 1158 # "en-US.pak". |
| 1159 # package_suffix: The package where the generated Java file should live. |
| 1160 # If not specified, "chrome" will be used, and the output Java file |
| 1161 # will reside in org.chromium.chrome (optional). |
| 1162 # |
| 1163 # Example |
| 1164 # locale_pak_assets("locale_pak") { |
| 1165 # package_suffix = "android_webview" |
| 1166 # sources = [ "path/en-US.pak", "path/fr.pak", ... ] |
| 1167 # } |
| 1168 # |
| 1169 # android_assets("chrome_public_apk_assets") { |
| 1170 # deps = [ "locale_pak_assets" ] |
| 1171 # } |
| 1172 # |
| 1173 # library_where_we_want_to_use_generated_srcjar("lib") { |
| 1174 # srcjar_deps = [ "locale_pak_srcjar" ] |
| 1175 # } |
| 1176 template("locale_pak_assets") { |
| 1177 set_sources_assignment_filter([]) |
| 1178 |
| 1179 if (defined(invoker.package_suffix)) { |
| 1180 package_suffix = invoker.package_suffix |
| 1181 } else { |
| 1182 package_suffix = "chrome" |
| 1183 } |
| 1184 |
| 1185 action("${target_name}_srcjar") { |
| 1186 _output_path = "$target_gen_dir/$target_name.srcjar" |
| 1187 _target = get_label_info(":$target_name", "label_no_toolchain") |
| 1188 |
| 1189 forward_variables_from(invoker, |
| 1190 [ |
| 1191 "deps", |
| 1192 "sources", |
| 1193 ]) |
| 1194 script = "//build/android/gyp/locale_pak_assets.py" |
| 1195 depfile = "$target_gen_dir/$target_name.d" |
| 1196 _rebased_sources = rebase_path(sources, root_build_dir) |
| 1197 |
| 1198 outputs = [ |
| 1199 _output_path, |
| 1200 ] |
| 1201 |
| 1202 args = [ |
| 1203 "--locale-paks=${_rebased_sources}", |
| 1204 "--srcjar", |
| 1205 rebase_path(_output_path, root_build_dir), |
| 1206 "--depfile", |
| 1207 rebase_path(depfile, root_build_dir), |
| 1208 "--target", |
| 1209 _target, |
| 1210 "--package-suffix", |
| 1211 package_suffix, |
| 1212 ] |
| 1213 } |
| 1214 |
| 1215 android_assets("${target_name}_assets") { |
| 1216 is_locale_asset = true |
| 1217 forward_variables_from(invoker, |
| 1218 [ |
| 1219 "sources", |
| 1220 "disable_compression", |
| 1221 ]) |
| 1222 } |
| 1223 } |
| 1224 |
| 1212 # Declare a java library target for a prebuilt jar | 1225 # Declare a java library target for a prebuilt jar |
| 1213 # | 1226 # |
| 1214 # Variables | 1227 # Variables |
| 1215 # deps: Specifies the dependencies of this target. Java targets in this list | 1228 # deps: Specifies the dependencies of this target. Java targets in this list |
| 1216 # will be added to the javac classpath. | 1229 # will be added to the javac classpath. |
| 1217 # jar_path: Path to the prebuilt jar. | 1230 # jar_path: Path to the prebuilt jar. |
| 1218 # jar_dep: Target that builds jar_path (optional). | 1231 # jar_dep: Target that builds jar_path (optional). |
| 1219 # proguard_preprocess: If true, proguard preprocessing will be run. This can | 1232 # proguard_preprocess: If true, proguard preprocessing will be run. This can |
| 1220 # be used to remove unwanted parts of the library. | 1233 # be used to remove unwanted parts of the library. |
| 1221 # proguard_preprocess_config: Path to the proguard config for preprocessing. | 1234 # proguard_preprocess_config: Path to the proguard config for preprocessing. |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 # dependencies will also be included in the apk (e.g. for is_component_bui
ld). | 1443 # dependencies will also be included in the apk (e.g. for is_component_bui
ld). |
| 1431 # native_lib_placeholders: List of placeholder filenames to add to the apk | 1444 # native_lib_placeholders: List of placeholder filenames to add to the apk |
| 1432 # (optional). | 1445 # (optional). |
| 1433 # apk_under_test: For an instrumentation test apk, this is the target of the | 1446 # apk_under_test: For an instrumentation test apk, this is the target of the |
| 1434 # tested apk. | 1447 # tested apk. |
| 1435 # include_all_resources - If true include all resource IDs in all generated | 1448 # include_all_resources - If true include all resource IDs in all generated |
| 1436 # R.java files. | 1449 # R.java files. |
| 1437 # testonly: Marks this target as "test-only". | 1450 # testonly: Marks this target as "test-only". |
| 1438 # write_asset_list: Adds an extra file to the assets, which contains a list
of | 1451 # write_asset_list: Adds an extra file to the assets, which contains a list
of |
| 1439 # all other asset files. | 1452 # all other asset files. |
| 1440 # alternative_locale_resource_dep: The locale resource target which override
s | 1453 # alternative_locale_asset_dep: The locale asset target which overrides |
| 1441 # any exsting locale resources in dep graph. | 1454 # any exsting locale asset in dep graph. |
| 1442 # requires_sdk_api_level_23: If defined and true, the apk is intended for | 1455 # requires_sdk_api_level_23: If defined and true, the apk is intended for |
| 1443 # installation only on Android M or later. In these releases the system | 1456 # installation only on Android M or later. In these releases the system |
| 1444 # linker does relocation unpacking, so we can enable it unconditionally. | 1457 # linker does relocation unpacking, so we can enable it unconditionally. |
| 1445 # secondary_native_libs (deprecated): The path of native libraries for secon
dary | 1458 # secondary_native_libs (deprecated): The path of native libraries for secon
dary |
| 1446 # app abi. | 1459 # app abi. |
| 1447 # run_findbugs_override: Forces run_findbugs on or off. If undefined, the | 1460 # run_findbugs_override: Forces run_findbugs on or off. If undefined, the |
| 1448 # default will use the build arg run_findbugs. | 1461 # default will use the build arg run_findbugs. |
| 1449 # proguard_jar_path: The path to proguard.jar you wish to use. If undefined, | 1462 # proguard_jar_path: The path to proguard.jar you wish to use. If undefined, |
| 1450 # the proguard used will be the checked in one in //third_party/proguard. | 1463 # the proguard used will be the checked in one in //third_party/proguard. |
| 1451 # | 1464 # |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1664 resources_zip = resources_zip_path | 1677 resources_zip = resources_zip_path |
| 1665 build_config = _build_config | 1678 build_config = _build_config |
| 1666 android_manifest = _android_manifest | 1679 android_manifest = _android_manifest |
| 1667 | 1680 |
| 1668 deps = _android_manifest_deps | 1681 deps = _android_manifest_deps |
| 1669 | 1682 |
| 1670 if (defined(invoker.deps)) { | 1683 if (defined(invoker.deps)) { |
| 1671 possible_config_deps = invoker.deps | 1684 possible_config_deps = invoker.deps |
| 1672 } | 1685 } |
| 1673 | 1686 |
| 1674 if (defined(invoker.alternative_locale_resource_dep)) { | 1687 if (defined(invoker.alternative_locale_asset_dep)) { |
| 1675 possible_config_deps += [ invoker.alternative_locale_resource_dep ] | 1688 possible_config_deps += [ invoker.alternative_locale_asset_dep ] |
| 1676 has_alternative_locale_resource = true | 1689 has_alternative_locale_asset = true |
| 1677 } | 1690 } |
| 1678 | 1691 |
| 1679 # Added emma to the target's classpath via its .build_config. | 1692 # Added emma to the target's classpath via its .build_config. |
| 1680 if (emma_coverage && !_emma_never_instrument) { | 1693 if (emma_coverage && !_emma_never_instrument) { |
| 1681 possible_config_deps += [ "//third_party/android_tools:emma_device" ] | 1694 possible_config_deps += [ "//third_party/android_tools:emma_device" ] |
| 1682 } | 1695 } |
| 1683 | 1696 |
| 1684 proguard_enabled = _proguard_enabled | 1697 proguard_enabled = _proguard_enabled |
| 1685 if (_proguard_enabled) { | 1698 if (_proguard_enabled) { |
| 1686 proguard_info = "$_proguard_output_jar_path.info" | 1699 proguard_info = "$_proguard_output_jar_path.info" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1719 zip_path = resources_zip_path | 1732 zip_path = resources_zip_path |
| 1720 all_resources_zip_path = _all_resources_zip_path | 1733 all_resources_zip_path = _all_resources_zip_path |
| 1721 generate_constant_ids = true | 1734 generate_constant_ids = true |
| 1722 proguard_file = _generated_proguard_config | 1735 proguard_file = _generated_proguard_config |
| 1723 | 1736 |
| 1724 build_config = _build_config | 1737 build_config = _build_config |
| 1725 deps = _android_manifest_deps + [ ":$build_config_target" ] | 1738 deps = _android_manifest_deps + [ ":$build_config_target" ] |
| 1726 if (defined(invoker.deps)) { | 1739 if (defined(invoker.deps)) { |
| 1727 deps += invoker.deps | 1740 deps += invoker.deps |
| 1728 } | 1741 } |
| 1729 if (defined(invoker.alternative_locale_resource_dep)) { | 1742 if (defined(invoker.alternative_locale_asset_dep)) { |
| 1730 deps += [ invoker.alternative_locale_resource_dep ] | 1743 deps += [ invoker.alternative_locale_asset_dep ] |
| 1731 } | 1744 } |
| 1732 } | 1745 } |
| 1733 _srcjar_deps += [ ":$process_resources_target" ] | 1746 _srcjar_deps += [ ":$process_resources_target" ] |
| 1734 | 1747 |
| 1735 if (_native_libs_deps != []) { | 1748 if (_native_libs_deps != []) { |
| 1736 _enable_chromium_linker_tests = false | 1749 _enable_chromium_linker_tests = false |
| 1737 if (defined(invoker.enable_chromium_linker_tests)) { | 1750 if (defined(invoker.enable_chromium_linker_tests)) { |
| 1738 _enable_chromium_linker_tests = invoker.enable_chromium_linker_tests | 1751 _enable_chromium_linker_tests = invoker.enable_chromium_linker_tests |
| 1739 } | 1752 } |
| 1740 _ordered_libraries_json = | 1753 _ordered_libraries_json = |
| (...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2820 # because in practice they seem to contain classes required to be in the | 2833 # because in practice they seem to contain classes required to be in the |
| 2821 # classpath. | 2834 # classpath. |
| 2822 deps += _subjar_targets | 2835 deps += _subjar_targets |
| 2823 } | 2836 } |
| 2824 if (defined(_res_target_name)) { | 2837 if (defined(_res_target_name)) { |
| 2825 deps += [ ":$_res_target_name" ] | 2838 deps += [ ":$_res_target_name" ] |
| 2826 } | 2839 } |
| 2827 } | 2840 } |
| 2828 } | 2841 } |
| 2829 } | 2842 } |
| OLD | NEW |