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("//build/toolchain/toolchain.gni") | 8 import("//build/toolchain/toolchain.gni") |
9 import("//third_party/android_platform/config.gni") | 9 import("//third_party/android_platform/config.gni") |
10 import("//tools/grit/grit_rule.gni") | 10 import("//tools/grit/grit_rule.gni") |
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1307 | 1307 |
1308 deps = _chromium_linker_dep + _android_manifest_deps | 1308 deps = _chromium_linker_dep + _android_manifest_deps |
1309 if (defined(invoker.deps)) { | 1309 if (defined(invoker.deps)) { |
1310 deps += invoker.deps | 1310 deps += invoker.deps |
1311 } | 1311 } |
1312 | 1312 |
1313 native_libs = _native_libs | 1313 native_libs = _native_libs |
1314 } | 1314 } |
1315 | 1315 |
1316 _final_deps = [] | 1316 _final_deps = [] |
1317 _incremental_final_deps = [] | |
1318 | 1317 |
1319 process_resources_target = "${_template_name}__process_resources" | 1318 process_resources_target = "${_template_name}__process_resources" |
1320 process_resources(process_resources_target) { | 1319 process_resources(process_resources_target) { |
1321 forward_variables_from(invoker, [ "include_all_resources" ]) | 1320 forward_variables_from(invoker, [ "include_all_resources" ]) |
1322 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" | 1321 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" |
1323 r_text_path = "${target_gen_dir}/${target_name}_R.txt" | 1322 r_text_path = "${target_gen_dir}/${target_name}_R.txt" |
1324 android_manifest = _android_manifest | 1323 android_manifest = _android_manifest |
1325 resource_dirs = [ "//build/android/ant/empty/res" ] | 1324 resource_dirs = [ "//build/android/ant/empty/res" ] |
1326 zip_path = resources_zip_path | 1325 zip_path = resources_zip_path |
1327 all_resources_zip_path = _all_resources_zip_path | 1326 all_resources_zip_path = _all_resources_zip_path |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1444 ] | 1443 ] |
1445 output = final_dex_path | 1444 output = final_dex_path |
1446 _dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" | 1445 _dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" |
1447 args = [ | 1446 args = [ |
1448 "--inputs=@FileArg($_dex_arg_key)", | 1447 "--inputs=@FileArg($_dex_arg_key)", |
1449 _rebased_lib_dex_path, | 1448 _rebased_lib_dex_path, |
1450 ] | 1449 ] |
1451 } | 1450 } |
1452 | 1451 |
1453 if (_native_libs != []) { | 1452 if (_native_libs != []) { |
1454 action("${_template_name}__prepare_native") { | 1453 _prepare_native_target_name = "${_template_name}__prepare_native" |
1454 action(_prepare_native_target_name) { | |
1455 forward_variables_from(invoker, | 1455 forward_variables_from(invoker, |
1456 [ | 1456 [ |
1457 "data_deps", | 1457 "data_deps", |
1458 "public_deps", | 1458 "public_deps", |
1459 ]) | 1459 ]) |
1460 script = "//build/android/gyp/pack_relocations.py" | 1460 script = "//build/android/gyp/pack_relocations.py" |
1461 packed_libraries_dir = "$_native_libs_dir/$android_app_abi" | 1461 packed_libraries_dir = "$_native_libs_dir/$android_app_abi" |
1462 depfile = "$target_gen_dir/$target_name.d" | 1462 depfile = "$target_gen_dir/$target_name.d" |
1463 outputs = [ | 1463 outputs = [ |
1464 depfile, | 1464 depfile, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1502 | 1502 |
1503 if (is_debug) { | 1503 if (is_debug) { |
1504 rebased_gdbserver = rebase_path([ android_gdbserver ], root_build_dir) | 1504 rebased_gdbserver = rebase_path([ android_gdbserver ], root_build_dir) |
1505 inputs += [ android_gdbserver ] | 1505 inputs += [ android_gdbserver ] |
1506 args += [ "--libraries=$rebased_gdbserver" ] | 1506 args += [ "--libraries=$rebased_gdbserver" ] |
1507 } | 1507 } |
1508 } | 1508 } |
1509 } | 1509 } |
1510 | 1510 |
1511 _final_deps += [ ":${_template_name}__create" ] | 1511 _final_deps += [ ":${_template_name}__create" ] |
1512 _incremental_final_deps += [ ":${_template_name}__create_incremental" ] | |
1513 create_apk("${_template_name}__create") { | 1512 create_apk("${_template_name}__create") { |
1514 forward_variables_from(invoker, [ "language_splits" ]) | 1513 deps = [] |
1514 forward_variables_from(invoker, | |
1515 [ | |
1516 "asset_location", | |
1517 "deps", | |
1518 "extensions_to_not_compress", | |
1519 "language_splits", | |
1520 ]) | |
1515 apk_path = _final_apk_path | 1521 apk_path = _final_apk_path |
1516 android_manifest = _android_manifest | 1522 android_manifest = _android_manifest |
1517 resources_zip = _all_resources_zip_path | 1523 resources_zip = _all_resources_zip_path |
1518 dex_path = final_dex_path | 1524 dex_path = final_dex_path |
1519 load_library_from_apk = _load_library_from_apk | 1525 load_library_from_apk = _load_library_from_apk |
1520 create_density_splits = _create_density_splits | 1526 create_density_splits = _create_density_splits |
1521 if (defined(invoker.extensions_to_not_compress)) { | 1527 |
1522 extensions_to_not_compress = invoker.extensions_to_not_compress | 1528 if (!defined(extensions_to_not_compress)) { |
1523 } else { | |
1524 # Allow icu data, v8 snapshots, and pak files to be loaded directly from | 1529 # Allow icu data, v8 snapshots, and pak files to be loaded directly from |
1525 # the .apk. | 1530 # the .apk. |
1526 # Note: These are actually suffix matches, not necessarily extensions. | 1531 # Note: These are actually suffix matches, not necessarily extensions. |
1527 extensions_to_not_compress = ".dat,.bin,.pak" | 1532 extensions_to_not_compress = ".dat,.bin,.pak" |
1528 } | 1533 } |
1529 | 1534 |
1530 version_code = _version_code | 1535 version_code = _version_code |
1531 version_name = _version_name | 1536 version_name = _version_name |
1532 | 1537 |
1533 keystore_name = _keystore_name | 1538 keystore_name = _keystore_name |
1534 keystore_path = _keystore_path | 1539 keystore_path = _keystore_path |
1535 keystore_password = _keystore_password | 1540 keystore_password = _keystore_password |
1536 | 1541 |
1542 # Incremental apk does not use native libs nor final dex. | |
1543 incremental_deps = | |
1544 deps + _android_manifest_deps + [ ":$process_resources_target" ] | |
1545 | |
1537 # This target generates the input file _all_resources_zip_path. | 1546 # This target generates the input file _all_resources_zip_path. |
1538 deps = _android_manifest_deps + [ | 1547 deps += _android_manifest_deps + [ |
1539 ":$process_resources_target", | 1548 ":$process_resources_target", |
1540 ":$final_dex_target_name", | 1549 ":$final_dex_target_name", |
1541 ] | 1550 ] |
1542 incremental_deps = _android_manifest_deps + [ ":$process_resources_target" ] | |
1543 if (defined(invoker.deps)) { | |
1544 deps += invoker.deps | |
1545 incremental_deps += invoker.deps | |
1546 } | |
1547 | |
1548 if (defined(invoker.asset_location)) { | |
1549 asset_location = invoker.asset_location | |
1550 | |
1551 # We don't know the exact dependencies that create the assets in | |
1552 # |asset_location|; we depend on all caller deps until a better solution | |
1553 # is figured out (http://crbug.com/433330). | |
1554 if (defined(invoker.deps)) { | |
1555 deps += invoker.deps | |
1556 } | |
1557 } | |
1558 | 1551 |
1559 if (_native_libs != [] && !_create_abi_split) { | 1552 if (_native_libs != [] && !_create_abi_split) { |
1560 native_libs_dir = _native_libs_dir | 1553 native_libs_dir = _native_libs_dir |
1561 deps += [ ":${_template_name}__prepare_native" ] | 1554 deps += [ ":$_prepare_native_target_name" ] |
1562 } | 1555 } |
1563 } | 1556 } |
1564 | 1557 |
1565 if (_native_libs != [] && _create_abi_split) { | 1558 if (_native_libs != [] && _create_abi_split) { |
1566 _manifest_rule = "${_template_name}__split_manifest_abi_${android_app_abi}" | 1559 _manifest_rule = "${_template_name}__split_manifest_abi_${android_app_abi}" |
1567 generate_split_manifest(_manifest_rule) { | 1560 generate_split_manifest(_manifest_rule) { |
1568 main_manifest = _android_manifest | 1561 main_manifest = _android_manifest |
1569 out_manifest = | 1562 out_manifest = |
1570 "$gen_dir/split-manifests/${android_app_abi}/AndroidManifest.xml" | 1563 "$gen_dir/split-manifests/${android_app_abi}/AndroidManifest.xml" |
1571 split_name = "abi_${android_app_abi}" | 1564 split_name = "abi_${android_app_abi}" |
1572 deps = _android_manifest_deps | 1565 deps = _android_manifest_deps |
1573 } | 1566 } |
1574 | 1567 |
1575 _apk_rule = "${_template_name}__split_apk_abi_${android_app_abi}" | 1568 _apk_rule = "${_template_name}__split_apk_abi_${android_app_abi}" |
1576 _final_deps += [ ":$_apk_rule" ] | 1569 _final_deps += [ ":$_apk_rule" ] |
1577 | 1570 |
1578 # Don't add this to _incremental_final_deps since for incremental installs | |
1579 # we skip abi splits altogether. | |
1580 create_apk(_apk_rule) { | 1571 create_apk(_apk_rule) { |
1581 apk_path = "${_final_apk_path_no_ext}-abi-${android_app_abi}.apk" | 1572 apk_path = "${_final_apk_path_no_ext}-abi-${android_app_abi}.apk" |
1582 base_path = "$gen_dir/$_apk_rule" | 1573 base_path = "$gen_dir/$_apk_rule" |
1583 | 1574 |
1584 manifest_outputs = get_target_outputs(":${_manifest_rule}") | 1575 manifest_outputs = get_target_outputs(":${_manifest_rule}") |
1585 android_manifest = manifest_outputs[1] | 1576 android_manifest = manifest_outputs[1] |
1586 load_library_from_apk = _load_library_from_apk | 1577 load_library_from_apk = _load_library_from_apk |
1587 | 1578 |
1588 version_code = _version_code | 1579 version_code = _version_code |
1589 version_name = _version_name | 1580 version_name = _version_name |
1590 | 1581 |
1591 keystore_name = _keystore_name | 1582 keystore_name = _keystore_name |
1592 keystore_path = _keystore_path | 1583 keystore_path = _keystore_path |
1593 keystore_password = _keystore_password | 1584 keystore_password = _keystore_password |
1594 | 1585 |
1595 native_libs_dir = _native_libs_dir | 1586 native_libs_dir = _native_libs_dir |
1596 deps = [ | 1587 deps = [ |
1597 ":${_template_name}__prepare_native", | 1588 ":${_prepare_native_target_name}", |
1598 ":${_manifest_rule}", | 1589 ":${_manifest_rule}", |
1599 ] | 1590 ] |
1600 incremental_deps = deps | 1591 incremental_deps = deps |
1601 } | 1592 } |
1602 } | 1593 } |
1603 | 1594 |
1604 _create_incremental_script_rule_name = "${_template_name}__incremental_script" | 1595 _create_incremental_script_rule_name = "${_template_name}__incremental_script" |
1605 _incremental_final_deps += [ ":${_create_incremental_script_rule_name}" ] | |
1606 action(_create_incremental_script_rule_name) { | 1596 action(_create_incremental_script_rule_name) { |
1607 script = "//build/android/incremental_install/create_install_script.py" | 1597 script = "//build/android/incremental_install/create_install_script.py" |
1608 depfile = "$target_gen_dir/$target_name.d" | 1598 depfile = "$target_gen_dir/$target_name.d" |
1609 deps = [ | 1599 deps = [ |
1610 ":$build_config_target", | 1600 ":$build_config_target", |
1611 ] | 1601 ] |
1612 | 1602 |
1613 _generated_script_path = | 1603 _generated_script_path = |
1614 "${root_out_dir}/bin/install_incremental_${_template_name}" | 1604 "${root_out_dir}/bin/install_incremental_${_template_name}" |
1615 outputs = [ | 1605 outputs = [ |
(...skipping 26 matching lines...) Expand all Loading... | |
1642 } | 1632 } |
1643 } | 1633 } |
1644 | 1634 |
1645 group(target_name) { | 1635 group(target_name) { |
1646 forward_variables_from(invoker, [ "data_deps" ]) | 1636 forward_variables_from(invoker, [ "data_deps" ]) |
1647 public_deps = _final_deps | 1637 public_deps = _final_deps |
1648 } | 1638 } |
1649 group("${target_name}_incremental") { | 1639 group("${target_name}_incremental") { |
1650 data_deps = [] | 1640 data_deps = [] |
1651 forward_variables_from(invoker, [ "data_deps" ]) | 1641 forward_variables_from(invoker, [ "data_deps" ]) |
1642 | |
1643 # device/commands is used by the installer script to push files via .zip. | |
1652 data_deps += [ "//build/android/pylib/device/commands" ] | 1644 data_deps += [ "//build/android/pylib/device/commands" ] |
1653 public_deps = _incremental_final_deps | 1645 |
1646 # Since the _incremental.apk does not include use .so nor .dex from the | |
1647 # actual target, but instead loads them at runtime, we need to explicitly | |
1648 # depend on them here. | |
pkotwicz
2015/09/25 14:19:30
Thanks for the comment!
| |
1649 public_deps = [ | |
1650 ":${_template_name}__create_incremental", | |
1651 ":${_create_incremental_script_rule_name}", | |
1652 ":${java_target}", | |
1653 ] | |
1654 if (_native_libs != []) { | |
1655 public_deps += [ ":$_prepare_native_target_name" ] | |
1656 } | |
1654 } | 1657 } |
1655 } | 1658 } |
1656 | 1659 |
1657 # Declare an Android instrumentation test apk | 1660 # Declare an Android instrumentation test apk |
1658 # | 1661 # |
1659 # This target creates an Android instrumentation test apk. | 1662 # This target creates an Android instrumentation test apk. |
1660 # | 1663 # |
1661 # Variables | 1664 # Variables |
1662 # android_manifest: Path to AndroidManifest.xml. | 1665 # android_manifest: Path to AndroidManifest.xml. |
1663 # data_deps: List of dependencies needed at runtime. These will be built but | 1666 # data_deps: List of dependencies needed at runtime. These will be built but |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2033 | 2036 |
2034 # TODO(GYP): implement this. | 2037 # TODO(GYP): implement this. |
2035 template("uiautomator_test") { | 2038 template("uiautomator_test") { |
2036 set_sources_assignment_filter([]) | 2039 set_sources_assignment_filter([]) |
2037 forward_variables_from(invoker, [ "testonly" ]) | 2040 forward_variables_from(invoker, [ "testonly" ]) |
2038 assert(target_name != "") | 2041 assert(target_name != "") |
2039 assert(invoker.deps != [] || true) | 2042 assert(invoker.deps != [] || true) |
2040 group(target_name) { | 2043 group(target_name) { |
2041 } | 2044 } |
2042 } | 2045 } |
OLD | NEW |