| 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 747 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). | 1367 # 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 | 1368 # native_lib_placeholders: List of placeholder filenames to add to the apk |
| 1432 # (optional). | 1369 # (optional). |
| 1433 # apk_under_test: For an instrumentation test apk, this is the target of the | 1370 # apk_under_test: For an instrumentation test apk, this is the target of the |
| 1434 # tested apk. | 1371 # tested apk. |
| 1435 # include_all_resources - If true include all resource IDs in all generated | 1372 # include_all_resources - If true include all resource IDs in all generated |
| 1436 # R.java files. | 1373 # R.java files. |
| 1437 # testonly: Marks this target as "test-only". | 1374 # testonly: Marks this target as "test-only". |
| 1438 # write_asset_list: Adds an extra file to the assets, which contains a list
of | 1375 # write_asset_list: Adds an extra file to the assets, which contains a list
of |
| 1439 # all other asset files. | 1376 # all other asset files. |
| 1440 # alternative_locale_resource_dep: The locale resource target which override
s | |
| 1441 # any exsting locale resources in dep graph. | |
| 1442 # requires_sdk_api_level_23: If defined and true, the apk is intended for | 1377 # 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 | 1378 # installation only on Android M or later. In these releases the system |
| 1444 # linker does relocation unpacking, so we can enable it unconditionally. | 1379 # linker does relocation unpacking, so we can enable it unconditionally. |
| 1445 # secondary_native_libs (deprecated): The path of native libraries for secon
dary | 1380 # secondary_native_libs (deprecated): The path of native libraries for secon
dary |
| 1446 # app abi. | 1381 # app abi. |
| 1447 # run_findbugs_override: Forces run_findbugs on or off. If undefined, the | 1382 # run_findbugs_override: Forces run_findbugs on or off. If undefined, the |
| 1448 # default will use the build arg run_findbugs. | 1383 # default will use the build arg run_findbugs. |
| 1449 # proguard_jar_path: The path to proguard.jar you wish to use. If undefined, | 1384 # 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. | 1385 # the proguard used will be the checked in one in //third_party/proguard. |
| 1451 # | 1386 # |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1664 resources_zip = resources_zip_path | 1599 resources_zip = resources_zip_path |
| 1665 build_config = _build_config | 1600 build_config = _build_config |
| 1666 android_manifest = _android_manifest | 1601 android_manifest = _android_manifest |
| 1667 | 1602 |
| 1668 deps = _android_manifest_deps | 1603 deps = _android_manifest_deps |
| 1669 | 1604 |
| 1670 if (defined(invoker.deps)) { | 1605 if (defined(invoker.deps)) { |
| 1671 possible_config_deps = invoker.deps | 1606 possible_config_deps = invoker.deps |
| 1672 } | 1607 } |
| 1673 | 1608 |
| 1674 if (defined(invoker.alternative_locale_resource_dep)) { | |
| 1675 possible_config_deps += [ invoker.alternative_locale_resource_dep ] | |
| 1676 has_alternative_locale_resource = true | |
| 1677 } | |
| 1678 | |
| 1679 # Added emma to the target's classpath via its .build_config. | 1609 # Added emma to the target's classpath via its .build_config. |
| 1680 if (emma_coverage && !_emma_never_instrument) { | 1610 if (emma_coverage && !_emma_never_instrument) { |
| 1681 possible_config_deps += [ "//third_party/android_tools:emma_device" ] | 1611 possible_config_deps += [ "//third_party/android_tools:emma_device" ] |
| 1682 } | 1612 } |
| 1683 | 1613 |
| 1684 proguard_enabled = _proguard_enabled | 1614 proguard_enabled = _proguard_enabled |
| 1685 if (_proguard_enabled) { | 1615 if (_proguard_enabled) { |
| 1686 proguard_info = "$_proguard_output_jar_path.info" | 1616 proguard_info = "$_proguard_output_jar_path.info" |
| 1687 } | 1617 } |
| 1688 | 1618 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1719 zip_path = resources_zip_path | 1649 zip_path = resources_zip_path |
| 1720 all_resources_zip_path = _all_resources_zip_path | 1650 all_resources_zip_path = _all_resources_zip_path |
| 1721 generate_constant_ids = true | 1651 generate_constant_ids = true |
| 1722 proguard_file = _generated_proguard_config | 1652 proguard_file = _generated_proguard_config |
| 1723 | 1653 |
| 1724 build_config = _build_config | 1654 build_config = _build_config |
| 1725 deps = _android_manifest_deps + [ ":$build_config_target" ] | 1655 deps = _android_manifest_deps + [ ":$build_config_target" ] |
| 1726 if (defined(invoker.deps)) { | 1656 if (defined(invoker.deps)) { |
| 1727 deps += invoker.deps | 1657 deps += invoker.deps |
| 1728 } | 1658 } |
| 1729 if (defined(invoker.alternative_locale_resource_dep)) { | |
| 1730 deps += [ invoker.alternative_locale_resource_dep ] | |
| 1731 } | |
| 1732 } | 1659 } |
| 1733 _srcjar_deps += [ ":$process_resources_target" ] | 1660 _srcjar_deps += [ ":$process_resources_target" ] |
| 1734 | 1661 |
| 1735 if (_native_libs_deps != []) { | 1662 if (_native_libs_deps != []) { |
| 1736 _enable_chromium_linker_tests = false | 1663 _enable_chromium_linker_tests = false |
| 1737 if (defined(invoker.enable_chromium_linker_tests)) { | 1664 if (defined(invoker.enable_chromium_linker_tests)) { |
| 1738 _enable_chromium_linker_tests = invoker.enable_chromium_linker_tests | 1665 _enable_chromium_linker_tests = invoker.enable_chromium_linker_tests |
| 1739 } | 1666 } |
| 1740 _ordered_libraries_json = | 1667 _ordered_libraries_json = |
| 1741 "$target_gen_dir/$target_name.ordered_libararies.json" | 1668 "$target_gen_dir/$target_name.ordered_libararies.json" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1792 } | 1719 } |
| 1793 _srcjar_deps += [ ":${_template_name}__native_libraries_java" ] | 1720 _srcjar_deps += [ ":${_template_name}__native_libraries_java" ] |
| 1794 } | 1721 } |
| 1795 | 1722 |
| 1796 if (!defined(invoker.apk_under_test)) { | 1723 if (!defined(invoker.apk_under_test)) { |
| 1797 java_cpp_template("${_template_name}__build_config_java") { | 1724 java_cpp_template("${_template_name}__build_config_java") { |
| 1798 package_name = "org/chromium/base" | 1725 package_name = "org/chromium/base" |
| 1799 sources = [ | 1726 sources = [ |
| 1800 "//base/android/java/templates/BuildConfig.template", | 1727 "//base/android/java/templates/BuildConfig.template", |
| 1801 ] | 1728 ] |
| 1729 deps = [ |
| 1730 ":$build_config_target", |
| 1731 ] |
| 1802 | 1732 |
| 1803 defines = [] | 1733 defines = [] |
| 1804 if (enable_multidex) { | 1734 if (enable_multidex) { |
| 1805 defines += [ "ENABLE_MULTIDEX" ] | 1735 defines += [ "ENABLE_MULTIDEX" ] |
| 1806 } | 1736 } |
| 1807 if (is_java_debug || dcheck_always_on) { | 1737 if (is_java_debug || dcheck_always_on) { |
| 1808 defines += [ "_DCHECK_IS_ON" ] | 1738 defines += [ "_DCHECK_IS_ON" ] |
| 1809 } | 1739 } |
| 1740 defines += [ |
| 1741 "COMPRESSED_ASSETS_LIST=" + |
| 1742 "@FileArg($_rebased_build_config:compressed_assets_java_list)", |
| 1743 "UNCOMPRESSED_ASSETS_LIST=" + |
| 1744 "@FileArg($_rebased_build_config:uncompressed_assets_java_list)", |
| 1745 ] |
| 1810 } | 1746 } |
| 1811 _srcjar_deps += [ ":${_template_name}__build_config_java" ] | 1747 _srcjar_deps += [ ":${_template_name}__build_config_java" ] |
| 1812 } | 1748 } |
| 1813 | 1749 |
| 1814 java_target = "${_template_name}__java" | 1750 java_target = "${_template_name}__java" |
| 1815 java_library_impl(java_target) { | 1751 java_library_impl(java_target) { |
| 1816 forward_variables_from(invoker, | 1752 forward_variables_from(invoker, |
| 1817 [ | 1753 [ |
| 1818 "chromium_code", | 1754 "chromium_code", |
| 1819 "java_files", | 1755 "java_files", |
| (...skipping 1000 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 | 2756 # because in practice they seem to contain classes required to be in the |
| 2821 # classpath. | 2757 # classpath. |
| 2822 deps += _subjar_targets | 2758 deps += _subjar_targets |
| 2823 } | 2759 } |
| 2824 if (defined(_res_target_name)) { | 2760 if (defined(_res_target_name)) { |
| 2825 deps += [ ":$_res_target_name" ] | 2761 deps += [ ":$_res_target_name" ] |
| 2826 } | 2762 } |
| 2827 } | 2763 } |
| 2828 } | 2764 } |
| 2829 } | 2765 } |
| OLD | NEW |