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 import("//base/android/linker/config.gni") | 5 import("//base/android/linker/config.gni") |
6 import("//build/config/android/config.gni") | 6 import("//build/config/android/config.gni") |
7 import("//build/config/android/internal_rules.gni") | 7 import("//build/config/android/internal_rules.gni") |
8 import("//third_party/android_platform/config.gni") | 8 import("//third_party/android_platform/config.gni") |
9 import("//tools/grit/grit_rule.gni") | 9 import("//tools/grit/grit_rule.gni") |
10 | 10 |
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 } | 1293 } |
1294 } | 1294 } |
1295 | 1295 |
1296 # Declare an Android apk target | 1296 # Declare an Android apk target |
1297 # | 1297 # |
1298 # This target creates an Android APK containing java code, resources, assets, | 1298 # This target creates an Android APK containing java code, resources, assets, |
1299 # and (possibly) native libraries. | 1299 # and (possibly) native libraries. |
1300 # | 1300 # |
1301 # Variables | 1301 # Variables |
1302 # android_manifest: Path to AndroidManifest.xml. | 1302 # android_manifest: Path to AndroidManifest.xml. |
| 1303 # android_manifest_dep: Target that generates AndroidManifest (if applicable) |
1303 # data_deps: List of dependencies needed at runtime. These will be built but | 1304 # data_deps: List of dependencies needed at runtime. These will be built but |
1304 # won't change the generated .apk in any way (in fact they may be built | 1305 # won't change the generated .apk in any way (in fact they may be built |
1305 # after the .apk is). | 1306 # after the .apk is). |
1306 # deps: List of dependencies. All Android java resources and libraries in the | 1307 # deps: List of dependencies. All Android java resources and libraries in the |
1307 # "transitive closure" of these dependencies will be included in the apk. | 1308 # "transitive closure" of these dependencies will be included in the apk. |
1308 # Note: this "transitive closure" actually only includes such targets if | 1309 # Note: this "transitive closure" actually only includes such targets if |
1309 # they are depended on through android_library or android_resources targets | 1310 # they are depended on through android_library or android_resources targets |
1310 # (and so not through builtin targets like 'action', 'group', etc). | 1311 # (and so not through builtin targets like 'action', 'group', etc). |
1311 # java_files: List of .java files to include in the apk. | 1312 # java_files: List of .java files to include in the apk. |
1312 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars | 1313 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 invoker.enable_relocation_packing) { | 1448 invoker.enable_relocation_packing) { |
1448 _enable_relocation_packing = true | 1449 _enable_relocation_packing = true |
1449 } | 1450 } |
1450 | 1451 |
1451 _native_lib_version_name = "" | 1452 _native_lib_version_name = "" |
1452 if (defined(invoker.native_lib_version_name)) { | 1453 if (defined(invoker.native_lib_version_name)) { |
1453 _native_lib_version_name = invoker.native_lib_version_name | 1454 _native_lib_version_name = invoker.native_lib_version_name |
1454 } | 1455 } |
1455 } | 1456 } |
1456 | 1457 |
| 1458 _android_manifest_deps = [] |
| 1459 if (defined(invoker.android_manifest_dep)) { |
| 1460 _android_manifest_deps = [ invoker.android_manifest_dep ] |
| 1461 } |
1457 _android_manifest = invoker.android_manifest | 1462 _android_manifest = invoker.android_manifest |
| 1463 |
1458 _rebased_build_config = rebase_path(_build_config, root_build_dir) | 1464 _rebased_build_config = rebase_path(_build_config, root_build_dir) |
1459 _create_abi_split = | 1465 _create_abi_split = |
1460 defined(invoker.create_abi_split) && invoker.create_abi_split | 1466 defined(invoker.create_abi_split) && invoker.create_abi_split |
1461 _create_density_splits = | 1467 _create_density_splits = |
1462 defined(invoker.create_density_splits) && invoker.create_density_splits | 1468 defined(invoker.create_density_splits) && invoker.create_density_splits |
1463 | 1469 |
1464 # Help GN understand that _create_abi_split is not unused (bug in GN). | 1470 # Help GN understand that _create_abi_split is not unused (bug in GN). |
1465 assert(_create_abi_split || true) | 1471 assert(_create_abi_split || true) |
1466 | 1472 |
1467 build_config_target = "${_template_name}__build_config" | 1473 build_config_target = "${_template_name}__build_config" |
1468 write_build_config(build_config_target) { | 1474 write_build_config(build_config_target) { |
1469 type = "android_apk" | 1475 type = "android_apk" |
1470 dex_path = final_dex_path | 1476 dex_path = final_dex_path |
1471 resources_zip = resources_zip_path | 1477 resources_zip = resources_zip_path |
1472 build_config = _build_config | 1478 build_config = _build_config |
1473 android_manifest = _android_manifest | 1479 android_manifest = _android_manifest |
1474 | 1480 |
1475 deps = _chromium_linker_dep | 1481 deps = _chromium_linker_dep + _android_manifest_deps |
1476 if (defined(invoker.deps)) { | 1482 if (defined(invoker.deps)) { |
1477 deps += invoker.deps | 1483 deps += invoker.deps |
1478 } | 1484 } |
1479 | 1485 |
1480 if (defined(invoker.apk_under_test)) { | 1486 if (defined(invoker.apk_under_test)) { |
1481 apk_under_test = invoker.apk_under_test | 1487 apk_under_test = invoker.apk_under_test |
1482 } | 1488 } |
1483 | 1489 |
1484 native_libs = _native_libs | 1490 native_libs = _native_libs |
1485 } | 1491 } |
1486 | 1492 |
1487 final_deps = [] | 1493 final_deps = [] |
1488 | 1494 |
1489 process_resources_target = "${_template_name}__process_resources" | 1495 process_resources_target = "${_template_name}__process_resources" |
1490 final_deps += [ ":$process_resources_target" ] | 1496 final_deps += [ ":$process_resources_target" ] |
1491 process_resources(process_resources_target) { | 1497 process_resources(process_resources_target) { |
1492 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" | 1498 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" |
1493 r_text_path = "${target_gen_dir}/${target_name}_R.txt" | 1499 r_text_path = "${target_gen_dir}/${target_name}_R.txt" |
1494 android_manifest = _android_manifest | 1500 android_manifest = _android_manifest |
1495 resource_dirs = [ "//build/android/ant/empty/res" ] | 1501 resource_dirs = [ "//build/android/ant/empty/res" ] |
1496 zip_path = resources_zip_path | 1502 zip_path = resources_zip_path |
1497 all_resources_zip_path = _all_resources_zip_path | 1503 all_resources_zip_path = _all_resources_zip_path |
1498 generate_constant_ids = true | 1504 generate_constant_ids = true |
1499 | 1505 |
1500 if (defined(invoker.include_all_resources)) { | 1506 if (defined(invoker.include_all_resources)) { |
1501 include_all_resources = invoker.include_all_resources | 1507 include_all_resources = invoker.include_all_resources |
1502 } | 1508 } |
1503 | 1509 |
1504 build_config = _build_config | 1510 build_config = _build_config |
1505 deps = [ | 1511 deps = _android_manifest_deps + [ ":$build_config_target" ] |
1506 ":$build_config_target", | |
1507 ] | |
1508 if (defined(invoker.deps)) { | 1512 if (defined(invoker.deps)) { |
1509 deps += invoker.deps | 1513 deps += invoker.deps |
1510 } | 1514 } |
1511 } | 1515 } |
1512 _srcjar_deps += [ ":$process_resources_target" ] | 1516 _srcjar_deps += [ ":$process_resources_target" ] |
1513 | 1517 |
1514 if (_native_libs != []) { | 1518 if (_native_libs != []) { |
1515 _enable_chromium_linker_tests = false | 1519 _enable_chromium_linker_tests = false |
1516 if (defined(invoker.enable_chromium_linker_tests)) { | 1520 if (defined(invoker.enable_chromium_linker_tests)) { |
1517 _enable_chromium_linker_tests = invoker.enable_chromium_linker_tests | 1521 _enable_chromium_linker_tests = invoker.enable_chromium_linker_tests |
(...skipping 28 matching lines...) Expand all Loading... |
1546 } | 1550 } |
1547 _srcjar_deps += [ ":${_template_name}__native_libraries_java" ] | 1551 _srcjar_deps += [ ":${_template_name}__native_libraries_java" ] |
1548 } | 1552 } |
1549 | 1553 |
1550 java_target = "${_template_name}__java" | 1554 java_target = "${_template_name}__java" |
1551 final_deps += [ ":$java_target" ] | 1555 final_deps += [ ":$java_target" ] |
1552 java_library_impl(java_target) { | 1556 java_library_impl(java_target) { |
1553 supports_android = true | 1557 supports_android = true |
1554 requires_android = true | 1558 requires_android = true |
1555 override_build_config = _build_config | 1559 override_build_config = _build_config |
1556 deps = [ | 1560 deps = _android_manifest_deps + [ ":$build_config_target" ] |
1557 ":$build_config_target", | |
1558 ] | |
1559 | 1561 |
1560 android_manifest = _android_manifest | 1562 android_manifest = _android_manifest |
1561 chromium_code = true | 1563 chromium_code = true |
1562 if (defined(invoker.java_files)) { | 1564 if (defined(invoker.java_files)) { |
1563 java_files = invoker.java_files | 1565 java_files = invoker.java_files |
1564 } else if (defined(invoker.DEPRECATED_java_in_dir)) { | 1566 } else if (defined(invoker.DEPRECATED_java_in_dir)) { |
1565 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir | 1567 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir |
1566 } else { | 1568 } else { |
1567 java_files = [] | 1569 java_files = [] |
1568 } | 1570 } |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 } | 1707 } |
1706 | 1708 |
1707 version_code = _version_code | 1709 version_code = _version_code |
1708 version_name = _version_name | 1710 version_name = _version_name |
1709 | 1711 |
1710 keystore_name = _keystore_name | 1712 keystore_name = _keystore_name |
1711 keystore_path = _keystore_path | 1713 keystore_path = _keystore_path |
1712 keystore_password = _keystore_password | 1714 keystore_password = _keystore_password |
1713 | 1715 |
1714 # This target generates the input file _all_resources_zip_path. | 1716 # This target generates the input file _all_resources_zip_path. |
1715 deps = [ | 1717 deps = _android_manifest_deps + [ |
1716 ":$process_resources_target", | 1718 ":$process_resources_target", |
1717 ":$final_dex_target_name", | 1719 ":$final_dex_target_name", |
1718 ] | 1720 ] |
1719 if (defined(invoker.deps)) { | 1721 if (defined(invoker.deps)) { |
1720 deps += invoker.deps | 1722 deps += invoker.deps |
1721 } | 1723 } |
1722 | 1724 |
1723 if (defined(invoker.asset_location)) { | 1725 if (defined(invoker.asset_location)) { |
1724 asset_location = invoker.asset_location | 1726 asset_location = invoker.asset_location |
1725 | 1727 |
1726 # We don't know the exact dependencies that create the assets in | 1728 # We don't know the exact dependencies that create the assets in |
1727 # |asset_location|; we depend on all caller deps until a better solution | 1729 # |asset_location|; we depend on all caller deps until a better solution |
1728 # is figured out (http://crbug.com/433330). | 1730 # is figured out (http://crbug.com/433330). |
1729 if (defined(invoker.deps)) { | 1731 if (defined(invoker.deps)) { |
1730 deps += invoker.deps | 1732 deps += invoker.deps |
1731 } | 1733 } |
1732 } | 1734 } |
1733 | 1735 |
1734 if (_native_libs != [] && !_create_abi_split) { | 1736 if (_native_libs != [] && !_create_abi_split) { |
1735 native_libs_dir = _native_libs_dir | 1737 native_libs_dir = _native_libs_dir |
1736 deps += [ ":${_template_name}__prepare_native" ] | 1738 deps += [ ":${_template_name}__prepare_native" ] |
1737 } | 1739 } |
1738 } | 1740 } |
1739 | 1741 |
1740 if (_native_libs != [] && _create_abi_split) { | 1742 if (_native_libs != [] && _create_abi_split) { |
1741 _manifest_rule = "${_template_name}__split_manifest_abi_${android_app_abi}" | 1743 _manifest_rule = "${_template_name}__split_manifest_abi_${android_app_abi}" |
1742 generate_split_manifest(_manifest_rule) { | 1744 generate_split_manifest(_manifest_rule) { |
1743 main_manifest = _android_manifest | 1745 main_manifest = _android_manifest |
1744 out_manifest = | 1746 out_manifest = |
1745 "$gen_dir/split-manifests/${android_app_abi}/AndroidManifest.xml" | 1747 "$gen_dir/split-manifests/${android_app_abi}/AndroidManifest.xml" |
1746 split_name = "abi_${android_app_abi}" | 1748 split_name = "abi_${android_app_abi}" |
| 1749 deps = _android_manifest_deps |
1747 } | 1750 } |
1748 | 1751 |
1749 _apk_rule = "${_template_name}__split_apk_abi_${android_app_abi}" | 1752 _apk_rule = "${_template_name}__split_apk_abi_${android_app_abi}" |
1750 final_deps += [ ":$_apk_rule" ] | 1753 final_deps += [ ":$_apk_rule" ] |
1751 create_apk(_apk_rule) { | 1754 create_apk(_apk_rule) { |
1752 _split_paths = process_file_template( | 1755 _split_paths = process_file_template( |
1753 [ _final_apk_path ], | 1756 [ _final_apk_path ], |
1754 "{{source_dir}}/{{source_name_part}}-abi-${android_app_abi}.apk") | 1757 "{{source_dir}}/{{source_name_part}}-abi-${android_app_abi}.apk") |
1755 apk_path = _split_paths[0] | 1758 apk_path = _split_paths[0] |
1756 base_path = "$gen_dir/$_apk_rule" | 1759 base_path = "$gen_dir/$_apk_rule" |
1757 | 1760 |
1758 manifest_outputs = get_target_outputs(":${_manifest_rule}") | 1761 manifest_outputs = get_target_outputs(":${_manifest_rule}") |
1759 android_manifest = manifest_outputs[1] | 1762 android_manifest = manifest_outputs[1] |
1760 load_library_from_apk = _load_library_from_apk | 1763 load_library_from_apk = _load_library_from_apk |
1761 | 1764 |
1762 version_code = _version_code | 1765 version_code = _version_code |
1763 version_name = _version_name | 1766 version_name = _version_name |
1764 | 1767 |
1765 keystore_name = _keystore_name | 1768 keystore_name = _keystore_name |
1766 keystore_path = _keystore_path | 1769 keystore_path = _keystore_path |
1767 keystore_password = _keystore_password | 1770 keystore_password = _keystore_password |
1768 | 1771 |
1769 native_libs_dir = _native_libs_dir | 1772 native_libs_dir = _native_libs_dir |
1770 deps = [ | 1773 deps = [ |
1771 ":${_template_name}__prepare_native", | 1774 ":${_template_name}__prepare_native", |
| 1775 ":${_manifest_rule}", |
1772 ] | 1776 ] |
1773 } | 1777 } |
1774 } | 1778 } |
1775 | 1779 |
1776 group(target_name) { | 1780 group(target_name) { |
1777 deps = final_deps | 1781 deps = final_deps |
1778 if (defined(invoker.data_deps)) { | 1782 if (defined(invoker.data_deps)) { |
1779 data_deps = invoker.data_deps | 1783 data_deps = invoker.data_deps |
1780 } | 1784 } |
1781 } | 1785 } |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2207 template("uiautomator_test") { | 2211 template("uiautomator_test") { |
2208 set_sources_assignment_filter([]) | 2212 set_sources_assignment_filter([]) |
2209 if (defined(invoker.testonly)) { | 2213 if (defined(invoker.testonly)) { |
2210 testonly = invoker.testonly | 2214 testonly = invoker.testonly |
2211 } | 2215 } |
2212 assert(target_name != "") | 2216 assert(target_name != "") |
2213 assert(invoker.deps != [] || true) | 2217 assert(invoker.deps != [] || true) |
2214 group(target_name) { | 2218 group(target_name) { |
2215 } | 2219 } |
2216 } | 2220 } |
OLD | NEW |