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 |
610 # Declare an Android resources target | 673 # Declare an Android resources target |
611 # | 674 # |
612 # This creates a resources zip file that will be used when building an Android | 675 # This creates a resources zip file that will be used when building an Android |
613 # library or apk and included into a final apk. | 676 # library or apk and included into a final apk. |
614 # | 677 # |
615 # To include these resources in a library/apk, this target should be listed in | 678 # To include these resources in a library/apk, this target should be listed in |
616 # the library's deps. A library/apk will also include any resources used by it
s | 679 # the library's deps. A library/apk will also include any resources used by it
s |
617 # own dependencies. | 680 # own dependencies. |
618 # | 681 # |
619 # Variables | 682 # Variables |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 # dependencies will also be included in the apk (e.g. for is_component_bui
ld). | 1424 # dependencies will also be included in the apk (e.g. for is_component_bui
ld). |
1362 # native_lib_placeholders: List of placeholder filenames to add to the apk | 1425 # native_lib_placeholders: List of placeholder filenames to add to the apk |
1363 # (optional). | 1426 # (optional). |
1364 # apk_under_test: For an instrumentation test apk, this is the target of the | 1427 # apk_under_test: For an instrumentation test apk, this is the target of the |
1365 # tested apk. | 1428 # tested apk. |
1366 # include_all_resources - If true include all resource IDs in all generated | 1429 # include_all_resources - If true include all resource IDs in all generated |
1367 # R.java files. | 1430 # R.java files. |
1368 # testonly: Marks this target as "test-only". | 1431 # testonly: Marks this target as "test-only". |
1369 # write_asset_list: Adds an extra file to the assets, which contains a list
of | 1432 # write_asset_list: Adds an extra file to the assets, which contains a list
of |
1370 # all other asset files. | 1433 # all other asset files. |
| 1434 # alternative_locale_resource_dep: The locale resource target which override
s |
| 1435 # any exsting locale resources in dep graph. |
1371 # requires_sdk_api_level_23: If defined and true, the apk is intended for | 1436 # requires_sdk_api_level_23: If defined and true, the apk is intended for |
1372 # installation only on Android M or later. In these releases the system | 1437 # installation only on Android M or later. In these releases the system |
1373 # linker does relocation unpacking, so we can enable it unconditionally. | 1438 # linker does relocation unpacking, so we can enable it unconditionally. |
1374 # secondary_native_libs (deprecated): The path of native libraries for secon
dary | 1439 # secondary_native_libs (deprecated): The path of native libraries for secon
dary |
1375 # app abi. | 1440 # app abi. |
1376 # run_findbugs_override: Forces run_findbugs on or off. If undefined, the | 1441 # run_findbugs_override: Forces run_findbugs on or off. If undefined, the |
1377 # default will use the build arg run_findbugs. | 1442 # default will use the build arg run_findbugs. |
1378 # proguard_jar_path: The path to proguard.jar you wish to use. If undefined, | 1443 # proguard_jar_path: The path to proguard.jar you wish to use. If undefined, |
1379 # the proguard used will be the checked in one in //third_party/proguard. | 1444 # the proguard used will be the checked in one in //third_party/proguard. |
1380 # | 1445 # |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 resources_zip = resources_zip_path | 1658 resources_zip = resources_zip_path |
1594 build_config = _build_config | 1659 build_config = _build_config |
1595 android_manifest = _android_manifest | 1660 android_manifest = _android_manifest |
1596 | 1661 |
1597 deps = _android_manifest_deps | 1662 deps = _android_manifest_deps |
1598 | 1663 |
1599 if (defined(invoker.deps)) { | 1664 if (defined(invoker.deps)) { |
1600 possible_config_deps = invoker.deps | 1665 possible_config_deps = invoker.deps |
1601 } | 1666 } |
1602 | 1667 |
| 1668 if (defined(invoker.alternative_locale_resource_dep)) { |
| 1669 possible_config_deps += [ invoker.alternative_locale_resource_dep ] |
| 1670 has_alternative_locale_resource = true |
| 1671 } |
| 1672 |
1603 # Added emma to the target's classpath via its .build_config. | 1673 # Added emma to the target's classpath via its .build_config. |
1604 if (emma_coverage && !_emma_never_instrument) { | 1674 if (emma_coverage && !_emma_never_instrument) { |
1605 possible_config_deps += [ "//third_party/android_tools:emma_device" ] | 1675 possible_config_deps += [ "//third_party/android_tools:emma_device" ] |
1606 } | 1676 } |
1607 | 1677 |
1608 proguard_enabled = _proguard_enabled | 1678 proguard_enabled = _proguard_enabled |
1609 if (_proguard_enabled) { | 1679 if (_proguard_enabled) { |
1610 proguard_info = "$_proguard_output_jar_path.info" | 1680 proguard_info = "$_proguard_output_jar_path.info" |
1611 } | 1681 } |
1612 | 1682 |
(...skipping 30 matching lines...) Expand all Loading... |
1643 zip_path = resources_zip_path | 1713 zip_path = resources_zip_path |
1644 all_resources_zip_path = _all_resources_zip_path | 1714 all_resources_zip_path = _all_resources_zip_path |
1645 generate_constant_ids = true | 1715 generate_constant_ids = true |
1646 proguard_file = _generated_proguard_config | 1716 proguard_file = _generated_proguard_config |
1647 | 1717 |
1648 build_config = _build_config | 1718 build_config = _build_config |
1649 deps = _android_manifest_deps + [ ":$build_config_target" ] | 1719 deps = _android_manifest_deps + [ ":$build_config_target" ] |
1650 if (defined(invoker.deps)) { | 1720 if (defined(invoker.deps)) { |
1651 deps += invoker.deps | 1721 deps += invoker.deps |
1652 } | 1722 } |
| 1723 if (defined(invoker.alternative_locale_resource_dep)) { |
| 1724 deps += [ invoker.alternative_locale_resource_dep ] |
| 1725 } |
1653 } | 1726 } |
1654 _srcjar_deps += [ ":$process_resources_target" ] | 1727 _srcjar_deps += [ ":$process_resources_target" ] |
1655 | 1728 |
1656 if (_native_libs_deps != []) { | 1729 if (_native_libs_deps != []) { |
1657 _enable_chromium_linker_tests = false | 1730 _enable_chromium_linker_tests = false |
1658 if (defined(invoker.enable_chromium_linker_tests)) { | 1731 if (defined(invoker.enable_chromium_linker_tests)) { |
1659 _enable_chromium_linker_tests = invoker.enable_chromium_linker_tests | 1732 _enable_chromium_linker_tests = invoker.enable_chromium_linker_tests |
1660 } | 1733 } |
1661 _ordered_libraries_json = | 1734 _ordered_libraries_json = |
1662 "$target_gen_dir/$target_name.ordered_libararies.json" | 1735 "$target_gen_dir/$target_name.ordered_libararies.json" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1713 } | 1786 } |
1714 _srcjar_deps += [ ":${_template_name}__native_libraries_java" ] | 1787 _srcjar_deps += [ ":${_template_name}__native_libraries_java" ] |
1715 } | 1788 } |
1716 | 1789 |
1717 if (!defined(invoker.apk_under_test)) { | 1790 if (!defined(invoker.apk_under_test)) { |
1718 java_cpp_template("${_template_name}__build_config_java") { | 1791 java_cpp_template("${_template_name}__build_config_java") { |
1719 package_name = "org/chromium/base" | 1792 package_name = "org/chromium/base" |
1720 sources = [ | 1793 sources = [ |
1721 "//base/android/java/templates/BuildConfig.template", | 1794 "//base/android/java/templates/BuildConfig.template", |
1722 ] | 1795 ] |
1723 deps = [ | |
1724 ":$build_config_target", | |
1725 ] | |
1726 | 1796 |
1727 defines = [] | 1797 defines = [] |
1728 if (enable_multidex) { | 1798 if (enable_multidex) { |
1729 defines += [ "ENABLE_MULTIDEX" ] | 1799 defines += [ "ENABLE_MULTIDEX" ] |
1730 } | 1800 } |
1731 if (is_java_debug || dcheck_always_on) { | 1801 if (is_java_debug || dcheck_always_on) { |
1732 defines += [ "_DCHECK_IS_ON" ] | 1802 defines += [ "_DCHECK_IS_ON" ] |
1733 } | 1803 } |
1734 defines += [ | |
1735 "COMPRESSED_ASSETS_LIST=" + | |
1736 "@FileArg($_rebased_build_config:compressed_assets_java_list)", | |
1737 "UNCOMPRESSED_ASSETS_LIST=" + | |
1738 "@FileArg($_rebased_build_config:uncompressed_assets_java_list)", | |
1739 ] | |
1740 } | 1804 } |
1741 _srcjar_deps += [ ":${_template_name}__build_config_java" ] | 1805 _srcjar_deps += [ ":${_template_name}__build_config_java" ] |
1742 } | 1806 } |
1743 | 1807 |
1744 java_target = "${_template_name}__java" | 1808 java_target = "${_template_name}__java" |
1745 java_library_impl(java_target) { | 1809 java_library_impl(java_target) { |
1746 forward_variables_from(invoker, | 1810 forward_variables_from(invoker, |
1747 [ | 1811 [ |
1748 "chromium_code", | 1812 "chromium_code", |
1749 "java_files", | 1813 "java_files", |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2750 # because in practice they seem to contain classes required to be in the | 2814 # because in practice they seem to contain classes required to be in the |
2751 # classpath. | 2815 # classpath. |
2752 deps += _subjar_targets | 2816 deps += _subjar_targets |
2753 } | 2817 } |
2754 if (defined(_res_target_name)) { | 2818 if (defined(_res_target_name)) { |
2755 deps += [ ":$_res_target_name" ] | 2819 deps += [ ":$_res_target_name" ] |
2756 } | 2820 } |
2757 } | 2821 } |
2758 } | 2822 } |
2759 } | 2823 } |
OLD | NEW |