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_overrides/build.gni") | 7 import("//build_overrides/build.gni") |
8 import("//build/config/android/config.gni") | 8 import("//build/config/android/config.gni") |
9 import("//build/config/dcheck_always_on.gni") | 9 import("//build/config/dcheck_always_on.gni") |
10 import("//build/config/sanitizers/sanitizers.gni") | 10 import("//build/config/sanitizers/sanitizers.gni") |
(...skipping 14 matching lines...) Expand all Loading... |
25 "*:*_assets", | 25 "*:*_assets", |
26 "*android*:assets", | 26 "*android*:assets", |
27 "*:*_apk_*resources", | 27 "*:*_apk_*resources", |
28 "*android*:resources", | 28 "*android*:resources", |
29 "*:*_resources", | 29 "*:*_resources", |
30 "*:*_grd", | 30 "*:*_grd", |
31 "*:*locale_paks", | 31 "*:*locale_paks", |
32 | 32 |
33 # TODO(agrieve): Rename targets below to match above patterns. | 33 # TODO(agrieve): Rename targets below to match above patterns. |
34 "*android_webview/glue:glue", | 34 "*android_webview/glue:glue", |
| 35 "//build/android/rezip:rezip", |
35 "//chrome/test/android/cast_emulator:cast_emulator", | 36 "//chrome/test/android/cast_emulator:cast_emulator", |
36 ] | 37 ] |
37 | 38 |
38 # Targets that match the whitelist but are not actually java targets. | 39 # Targets that match the whitelist but are not actually java targets. |
39 _java_target_blacklist = [ | 40 _java_target_blacklist = [ |
40 "//chrome:packed_resources", | 41 "//chrome:packed_resources", |
41 "//remoting/android:remoting_android_raw_resources", | 42 "//remoting/android:remoting_android_raw_resources", |
42 "*:*_unpack_aar", | 43 "*:*_unpack_aar", |
43 ] | 44 ] |
44 | 45 |
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 } | 1386 } |
1386 | 1387 |
1387 # Signs & zipaligns an apk. | 1388 # Signs & zipaligns an apk. |
1388 # | 1389 # |
1389 # Variables | 1390 # Variables |
1390 # input_apk_path: Path of the .apk to be finalized. | 1391 # input_apk_path: Path of the .apk to be finalized. |
1391 # output_apk_path: Output path for the generated .apk. | 1392 # output_apk_path: Output path for the generated .apk. |
1392 # keystore_path: Path to keystore to use for signing. | 1393 # keystore_path: Path to keystore to use for signing. |
1393 # keystore_name: Key alias to use. | 1394 # keystore_name: Key alias to use. |
1394 # keystore_password: Keystore password. | 1395 # keystore_password: Keystore password. |
| 1396 # rezip_apk: Whether to add crazy-linker alignment. |
1395 template("finalize_apk") { | 1397 template("finalize_apk") { |
1396 action(target_name) { | 1398 action(target_name) { |
1397 deps = [] | 1399 deps = [] |
1398 script = "//build/android/gyp/finalize_apk.py" | 1400 script = "//build/android/gyp/finalize_apk.py" |
1399 depfile = "$target_gen_dir/$target_name.d" | 1401 depfile = "$target_gen_dir/$target_name.d" |
1400 forward_variables_from(invoker, | 1402 forward_variables_from(invoker, |
1401 [ | 1403 [ |
1402 "deps", | 1404 "deps", |
1403 "data_deps", | 1405 "data_deps", |
1404 "public_deps", | 1406 "public_deps", |
(...skipping 22 matching lines...) Expand all Loading... |
1427 rebase_path(invoker.input_apk_path, root_build_dir), | 1429 rebase_path(invoker.input_apk_path, root_build_dir), |
1428 "--final-apk-path", | 1430 "--final-apk-path", |
1429 rebase_path(invoker.output_apk_path, root_build_dir), | 1431 rebase_path(invoker.output_apk_path, root_build_dir), |
1430 "--key-path", | 1432 "--key-path", |
1431 rebase_path(invoker.keystore_path, root_build_dir), | 1433 rebase_path(invoker.keystore_path, root_build_dir), |
1432 "--key-name", | 1434 "--key-name", |
1433 invoker.keystore_name, | 1435 invoker.keystore_name, |
1434 "--key-passwd", | 1436 "--key-passwd", |
1435 invoker.keystore_password, | 1437 invoker.keystore_password, |
1436 ] | 1438 ] |
| 1439 if (defined(invoker.rezip_apk) && invoker.rezip_apk) { |
| 1440 deps += [ "//build/android/rezip" ] |
| 1441 _rezip_jar_path = "$root_build_dir/lib.java/rezip_apk.jar" |
| 1442 args += [ |
| 1443 "--load-library-from-zip=1", |
| 1444 "--rezip-apk-jar-path", |
| 1445 rebase_path(_rezip_jar_path, root_build_dir), |
| 1446 ] |
| 1447 } |
| 1448 |
| 1449 if (defined(invoker.page_align_shared_libraries) && |
| 1450 invoker.page_align_shared_libraries) { |
| 1451 args += [ "--page-align-shared-libraries" ] |
| 1452 } |
1437 } | 1453 } |
1438 } | 1454 } |
1439 | 1455 |
1440 # Packages resources, assets, dex, and native libraries into an apk. Signs and | 1456 # Packages resources, assets, dex, and native libraries into an apk. Signs and |
1441 # zipaligns the apk. | 1457 # zipaligns the apk. |
1442 template("create_apk") { | 1458 template("create_apk") { |
1443 set_sources_assignment_filter([]) | 1459 set_sources_assignment_filter([]) |
1444 forward_variables_from(invoker, [ "testonly" ]) | 1460 forward_variables_from(invoker, [ "testonly" ]) |
1445 | 1461 |
1446 _android_manifest = invoker.android_manifest | 1462 _android_manifest = invoker.android_manifest |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1669 [ | 1685 [ |
1670 "assets_build_config", | 1686 "assets_build_config", |
1671 "emma_instrument", | 1687 "emma_instrument", |
1672 "native_lib_placeholders", | 1688 "native_lib_placeholders", |
1673 "native_libs_filearg", | 1689 "native_libs_filearg", |
1674 "secondary_abi_native_libs_filearg", | 1690 "secondary_abi_native_libs_filearg", |
1675 "secondary_native_libs", | 1691 "secondary_native_libs", |
1676 "uncompress_shared_libraries", | 1692 "uncompress_shared_libraries", |
1677 "write_asset_list", | 1693 "write_asset_list", |
1678 ]) | 1694 ]) |
1679 if (!defined(uncompress_shared_libraries)) { | |
1680 uncompress_shared_libraries = _load_library_from_apk | |
1681 } | |
1682 deps = _deps + [ ":${_package_resources_target_name}" ] | 1695 deps = _deps + [ ":${_package_resources_target_name}" ] |
1683 native_libs = _native_libs + _native_libs_even_when_incremental | 1696 native_libs = _native_libs + _native_libs_even_when_incremental |
1684 | 1697 |
1685 if (defined(_dex_path)) { | 1698 if (defined(_dex_path)) { |
1686 dex_path = _dex_path | 1699 dex_path = _dex_path |
1687 } | 1700 } |
1688 | 1701 |
1689 output_apk_path = _packaged_apk_path | 1702 output_apk_path = _packaged_apk_path |
1690 resource_packaged_apk_path = _resource_packaged_apk_path | 1703 resource_packaged_apk_path = _resource_packaged_apk_path |
1691 } | 1704 } |
1692 | 1705 |
1693 _incremental_package_target = "${target_name}_incremental__package" | 1706 _incremental_package_target = "${target_name}_incremental__package" |
1694 package_apk(_incremental_package_target) { | 1707 package_apk(_incremental_package_target) { |
1695 forward_variables_from(invoker, | 1708 forward_variables_from(invoker, |
1696 [ | 1709 [ |
1697 "assets_build_config", | 1710 "assets_build_config", |
1698 "emma_instrument", | 1711 "emma_instrument", |
1699 "secondary_native_libs", | 1712 "secondary_native_libs", |
1700 "uncompress_shared_libraries", | 1713 "uncompress_shared_libraries", |
1701 ]) | 1714 ]) |
1702 if (!defined(uncompress_shared_libraries)) { | |
1703 uncompress_shared_libraries = _load_library_from_apk | |
1704 } | |
1705 _dex_target = "//build/android/incremental_install:bootstrap_java__dex" | 1715 _dex_target = "//build/android/incremental_install:bootstrap_java__dex" |
1706 deps = _incremental_deps + [ | 1716 deps = _incremental_deps + [ |
1707 ":${_incremental_package_resources_target_name}", | 1717 ":${_incremental_package_resources_target_name}", |
1708 _dex_target, | 1718 _dex_target, |
1709 ] | 1719 ] |
1710 | 1720 |
1711 if (defined(_dex_path)) { | 1721 if (defined(_dex_path)) { |
1712 dex_path = | 1722 dex_path = |
1713 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex" | 1723 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex" |
1714 } | 1724 } |
1715 | 1725 |
1716 native_libs = _native_libs_even_when_incremental | 1726 native_libs = _native_libs_even_when_incremental |
1717 | 1727 |
1718 # http://crbug.com/384638 | 1728 # http://crbug.com/384638 |
1719 _has_native_libs = | 1729 _has_native_libs = |
1720 defined(invoker.native_libs_filearg) || _native_libs != [] | 1730 defined(invoker.native_libs_filearg) || _native_libs != [] |
1721 if (_has_native_libs && _native_libs_even_when_incremental == []) { | 1731 if (_has_native_libs && _native_libs_even_when_incremental == []) { |
1722 native_lib_placeholders = [ "libfix.crbug.384638.so" ] | 1732 native_lib_placeholders = [ "libfix.crbug.384638.so" ] |
1723 } | 1733 } |
1724 | 1734 |
1725 output_apk_path = _incremental_packaged_apk_path | 1735 output_apk_path = _incremental_packaged_apk_path |
1726 resource_packaged_apk_path = _incremental_resource_packaged_apk_path | 1736 resource_packaged_apk_path = _incremental_resource_packaged_apk_path |
1727 } | 1737 } |
1728 | 1738 |
1729 _finalize_apk_rule_name = "${target_name}__finalize" | 1739 _finalize_apk_rule_name = "${target_name}__finalize" |
1730 finalize_apk(_finalize_apk_rule_name) { | 1740 finalize_apk(_finalize_apk_rule_name) { |
| 1741 forward_variables_from(invoker, [ "page_align_shared_libraries" ]) |
| 1742 |
1731 input_apk_path = _packaged_apk_path | 1743 input_apk_path = _packaged_apk_path |
1732 output_apk_path = _final_apk_path | 1744 output_apk_path = _final_apk_path |
1733 keystore_path = _keystore_path | 1745 keystore_path = _keystore_path |
1734 keystore_name = _keystore_name | 1746 keystore_name = _keystore_name |
1735 keystore_password = _keystore_password | 1747 keystore_password = _keystore_password |
| 1748 rezip_apk = _load_library_from_apk |
1736 | 1749 |
1737 public_deps = [ | 1750 public_deps = [ |
1738 # Generator of the _packaged_apk_path this target takes as input. | 1751 # Generator of the _packaged_apk_path this target takes as input. |
1739 ":$package_target", | 1752 ":$package_target", |
1740 ] | 1753 ] |
1741 } | 1754 } |
1742 | 1755 |
1743 _incremental_finalize_apk_rule_name = "${target_name}_incremental__finalize" | 1756 _incremental_finalize_apk_rule_name = "${target_name}_incremental__finalize" |
1744 finalize_apk(_incremental_finalize_apk_rule_name) { | 1757 finalize_apk(_incremental_finalize_apk_rule_name) { |
1745 input_apk_path = _incremental_packaged_apk_path | 1758 input_apk_path = _incremental_packaged_apk_path |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2807 rebase_path(root_build_dir, root_build_dir), | 2820 rebase_path(root_build_dir, root_build_dir), |
2808 "--packed-libraries-dir", | 2821 "--packed-libraries-dir", |
2809 rebase_path(_packed_libraries_dir, root_build_dir), | 2822 rebase_path(_packed_libraries_dir, root_build_dir), |
2810 "--libraries=${invoker.libraries_filearg}", | 2823 "--libraries=${invoker.libraries_filearg}", |
2811 "--filelistjson", | 2824 "--filelistjson", |
2812 rebase_path(invoker.file_list_json, root_build_dir), | 2825 rebase_path(invoker.file_list_json, root_build_dir), |
2813 ] | 2826 ] |
2814 } | 2827 } |
2815 } | 2828 } |
2816 } | 2829 } |
OLD | NEW |