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