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 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 } | 1378 } |
1378 | 1379 |
1379 # Signs & zipaligns an apk. | 1380 # Signs & zipaligns an apk. |
1380 # | 1381 # |
1381 # Variables | 1382 # Variables |
1382 # input_apk_path: Path of the .apk to be finalized. | 1383 # input_apk_path: Path of the .apk to be finalized. |
1383 # output_apk_path: Output path for the generated .apk. | 1384 # output_apk_path: Output path for the generated .apk. |
1384 # keystore_path: Path to keystore to use for signing. | 1385 # keystore_path: Path to keystore to use for signing. |
1385 # keystore_name: Key alias to use. | 1386 # keystore_name: Key alias to use. |
1386 # keystore_password: Keystore password. | 1387 # keystore_password: Keystore password. |
| 1388 # rezip_apk: Whether to add crazy-linker alignment. |
1387 template("finalize_apk") { | 1389 template("finalize_apk") { |
1388 action(target_name) { | 1390 action(target_name) { |
1389 deps = [] | 1391 deps = [] |
1390 script = "//build/android/gyp/finalize_apk.py" | 1392 script = "//build/android/gyp/finalize_apk.py" |
1391 depfile = "$target_gen_dir/$target_name.d" | 1393 depfile = "$target_gen_dir/$target_name.d" |
1392 forward_variables_from(invoker, | 1394 forward_variables_from(invoker, |
1393 [ | 1395 [ |
1394 "deps", | 1396 "deps", |
1395 "data_deps", | 1397 "data_deps", |
1396 "public_deps", | 1398 "public_deps", |
(...skipping 22 matching lines...) Expand all Loading... |
1419 rebase_path(invoker.input_apk_path, root_build_dir), | 1421 rebase_path(invoker.input_apk_path, root_build_dir), |
1420 "--final-apk-path", | 1422 "--final-apk-path", |
1421 rebase_path(invoker.output_apk_path, root_build_dir), | 1423 rebase_path(invoker.output_apk_path, root_build_dir), |
1422 "--key-path", | 1424 "--key-path", |
1423 rebase_path(invoker.keystore_path, root_build_dir), | 1425 rebase_path(invoker.keystore_path, root_build_dir), |
1424 "--key-name", | 1426 "--key-name", |
1425 invoker.keystore_name, | 1427 invoker.keystore_name, |
1426 "--key-passwd", | 1428 "--key-passwd", |
1427 invoker.keystore_password, | 1429 invoker.keystore_password, |
1428 ] | 1430 ] |
| 1431 if (defined(invoker.rezip_apk) && invoker.rezip_apk) { |
| 1432 deps += [ "//build/android/rezip" ] |
| 1433 _rezip_jar_path = "$root_build_dir/lib.java/rezip_apk.jar" |
| 1434 args += [ |
| 1435 "--load-library-from-zip=1", |
| 1436 "--rezip-apk-jar-path", |
| 1437 rebase_path(_rezip_jar_path, root_build_dir), |
| 1438 ] |
| 1439 } |
| 1440 |
| 1441 if (defined(invoker.page_align_shared_libraries) && |
| 1442 invoker.page_align_shared_libraries) { |
| 1443 args += [ "--page-align-shared-libraries" ] |
| 1444 } |
1429 } | 1445 } |
1430 } | 1446 } |
1431 | 1447 |
1432 # Packages resources, assets, dex, and native libraries into an apk. Signs and | 1448 # Packages resources, assets, dex, and native libraries into an apk. Signs and |
1433 # zipaligns the apk. | 1449 # zipaligns the apk. |
1434 template("create_apk") { | 1450 template("create_apk") { |
1435 set_sources_assignment_filter([]) | 1451 set_sources_assignment_filter([]) |
1436 forward_variables_from(invoker, [ "testonly" ]) | 1452 forward_variables_from(invoker, [ "testonly" ]) |
1437 | 1453 |
1438 _android_manifest = invoker.android_manifest | 1454 _android_manifest = invoker.android_manifest |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 [ | 1677 [ |
1662 "assets_build_config", | 1678 "assets_build_config", |
1663 "emma_instrument", | 1679 "emma_instrument", |
1664 "native_lib_placeholders", | 1680 "native_lib_placeholders", |
1665 "native_libs_filearg", | 1681 "native_libs_filearg", |
1666 "secondary_abi_native_libs_filearg", | 1682 "secondary_abi_native_libs_filearg", |
1667 "secondary_native_libs", | 1683 "secondary_native_libs", |
1668 "uncompress_shared_libraries", | 1684 "uncompress_shared_libraries", |
1669 "write_asset_list", | 1685 "write_asset_list", |
1670 ]) | 1686 ]) |
1671 if (!defined(uncompress_shared_libraries)) { | |
1672 uncompress_shared_libraries = _load_library_from_apk | |
1673 } | |
1674 deps = _deps + [ ":${_package_resources_target_name}" ] | 1687 deps = _deps + [ ":${_package_resources_target_name}" ] |
1675 native_libs = _native_libs + _native_libs_even_when_incremental | 1688 native_libs = _native_libs + _native_libs_even_when_incremental |
1676 | 1689 |
1677 if (defined(_dex_path)) { | 1690 if (defined(_dex_path)) { |
1678 dex_path = _dex_path | 1691 dex_path = _dex_path |
1679 } | 1692 } |
1680 | 1693 |
1681 output_apk_path = _packaged_apk_path | 1694 output_apk_path = _packaged_apk_path |
1682 resource_packaged_apk_path = _resource_packaged_apk_path | 1695 resource_packaged_apk_path = _resource_packaged_apk_path |
1683 } | 1696 } |
1684 | 1697 |
1685 _incremental_package_target = "${target_name}_incremental__package" | 1698 _incremental_package_target = "${target_name}_incremental__package" |
1686 package_apk(_incremental_package_target) { | 1699 package_apk(_incremental_package_target) { |
1687 forward_variables_from(invoker, | 1700 forward_variables_from(invoker, |
1688 [ | 1701 [ |
1689 "assets_build_config", | 1702 "assets_build_config", |
1690 "emma_instrument", | 1703 "emma_instrument", |
1691 "secondary_native_libs", | 1704 "secondary_native_libs", |
1692 "uncompress_shared_libraries", | 1705 "uncompress_shared_libraries", |
1693 ]) | 1706 ]) |
1694 if (!defined(uncompress_shared_libraries)) { | |
1695 uncompress_shared_libraries = _load_library_from_apk | |
1696 } | |
1697 _dex_target = "//build/android/incremental_install:bootstrap_java__dex" | 1707 _dex_target = "//build/android/incremental_install:bootstrap_java__dex" |
1698 deps = _incremental_deps + [ | 1708 deps = _incremental_deps + [ |
1699 ":${_incremental_package_resources_target_name}", | 1709 ":${_incremental_package_resources_target_name}", |
1700 _dex_target, | 1710 _dex_target, |
1701 ] | 1711 ] |
1702 | 1712 |
1703 if (defined(_dex_path)) { | 1713 if (defined(_dex_path)) { |
1704 dex_path = | 1714 dex_path = |
1705 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex" | 1715 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex" |
1706 } | 1716 } |
1707 | 1717 |
1708 native_libs = _native_libs_even_when_incremental | 1718 native_libs = _native_libs_even_when_incremental |
1709 | 1719 |
1710 # http://crbug.com/384638 | 1720 # http://crbug.com/384638 |
1711 _has_native_libs = | 1721 _has_native_libs = |
1712 defined(invoker.native_libs_filearg) || _native_libs != [] | 1722 defined(invoker.native_libs_filearg) || _native_libs != [] |
1713 if (_has_native_libs && _native_libs_even_when_incremental == []) { | 1723 if (_has_native_libs && _native_libs_even_when_incremental == []) { |
1714 native_lib_placeholders = [ "libfix.crbug.384638.so" ] | 1724 native_lib_placeholders = [ "libfix.crbug.384638.so" ] |
1715 } | 1725 } |
1716 | 1726 |
1717 output_apk_path = _incremental_packaged_apk_path | 1727 output_apk_path = _incremental_packaged_apk_path |
1718 resource_packaged_apk_path = _incremental_resource_packaged_apk_path | 1728 resource_packaged_apk_path = _incremental_resource_packaged_apk_path |
1719 } | 1729 } |
1720 | 1730 |
1721 _finalize_apk_rule_name = "${target_name}__finalize" | 1731 _finalize_apk_rule_name = "${target_name}__finalize" |
1722 finalize_apk(_finalize_apk_rule_name) { | 1732 finalize_apk(_finalize_apk_rule_name) { |
| 1733 forward_variables_from(invoker, [ "page_align_shared_libraries" ]) |
| 1734 |
1723 input_apk_path = _packaged_apk_path | 1735 input_apk_path = _packaged_apk_path |
1724 output_apk_path = _final_apk_path | 1736 output_apk_path = _final_apk_path |
1725 keystore_path = _keystore_path | 1737 keystore_path = _keystore_path |
1726 keystore_name = _keystore_name | 1738 keystore_name = _keystore_name |
1727 keystore_password = _keystore_password | 1739 keystore_password = _keystore_password |
| 1740 rezip_apk = _load_library_from_apk |
1728 | 1741 |
1729 public_deps = [ | 1742 public_deps = [ |
1730 # Generator of the _packaged_apk_path this target takes as input. | 1743 # Generator of the _packaged_apk_path this target takes as input. |
1731 ":$package_target", | 1744 ":$package_target", |
1732 ] | 1745 ] |
1733 } | 1746 } |
1734 | 1747 |
1735 _incremental_finalize_apk_rule_name = "${target_name}_incremental__finalize" | 1748 _incremental_finalize_apk_rule_name = "${target_name}_incremental__finalize" |
1736 finalize_apk(_incremental_finalize_apk_rule_name) { | 1749 finalize_apk(_incremental_finalize_apk_rule_name) { |
1737 input_apk_path = _incremental_packaged_apk_path | 1750 input_apk_path = _incremental_packaged_apk_path |
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2792 rebase_path(root_build_dir, root_build_dir), | 2805 rebase_path(root_build_dir, root_build_dir), |
2793 "--packed-libraries-dir", | 2806 "--packed-libraries-dir", |
2794 rebase_path(_packed_libraries_dir, root_build_dir), | 2807 rebase_path(_packed_libraries_dir, root_build_dir), |
2795 "--libraries=${invoker.libraries_filearg}", | 2808 "--libraries=${invoker.libraries_filearg}", |
2796 "--filelistjson", | 2809 "--filelistjson", |
2797 rebase_path(invoker.file_list_json, root_build_dir), | 2810 rebase_path(invoker.file_list_json, root_build_dir), |
2798 ] | 2811 ] |
2799 } | 2812 } |
2800 } | 2813 } |
2801 } | 2814 } |
OLD | NEW |