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