Chromium Code Reviews| 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("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
| 6 import("//build/config/android/internal_rules.gni") | 6 import("//build/config/android/internal_rules.gni") |
| 7 import("//build/toolchain/toolchain.gni") | 7 import("//build/toolchain/toolchain.gni") |
| 8 | 8 |
| 9 assert(is_android) | 9 assert(is_android) |
| 10 | 10 |
| (...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1419 # * dependencies of this .so are not automatically included | 1419 # * dependencies of this .so are not automatically included |
| 1420 # * ".cr.so" is never added | 1420 # * ".cr.so" is never added |
| 1421 # * they are not side-loaded for _incremental targets. | 1421 # * they are not side-loaded for _incremental targets. |
| 1422 # * load_library_from_apk, use_chromium_linker, | 1422 # * load_library_from_apk, use_chromium_linker, |
| 1423 # and enable_relocation_packing do not apply | 1423 # and enable_relocation_packing do not apply |
| 1424 # Use this instead of shared_libraries when you are going to load the libr ary | 1424 # Use this instead of shared_libraries when you are going to load the libr ary |
| 1425 # conditionally, and only when shared_libraries doesn't work for you. | 1425 # conditionally, and only when shared_libraries doesn't work for you. |
| 1426 # shared_libraries: List shared_library targets to bundle. If these | 1426 # shared_libraries: List shared_library targets to bundle. If these |
| 1427 # libraries depend on other shared_library targets, those dependencies wil l | 1427 # libraries depend on other shared_library targets, those dependencies wil l |
| 1428 # also be included in the apk (e.g. for is_component_build). | 1428 # also be included in the apk (e.g. for is_component_build). |
| 1429 # native_lib_placeholders: List of placeholder filenames to add to the apk | 1429 # native_lib_placeholders: List of placeholder filenames to add to the apk. |
| 1430 # (optional). | 1430 # These placeholders are necessary for some older devices - see |
| 1431 # http://crbug.com/395038. | |
| 1431 # apk_under_test: For an instrumentation test apk, this is the target of the | 1432 # apk_under_test: For an instrumentation test apk, this is the target of the |
| 1432 # tested apk. | 1433 # tested apk. |
| 1433 # include_all_resources - If true include all resource IDs in all generated | 1434 # include_all_resources - If true include all resource IDs in all generated |
| 1434 # R.java files. | 1435 # R.java files. |
| 1435 # testonly: Marks this target as "test-only". | 1436 # testonly: Marks this target as "test-only". |
| 1436 # write_asset_list: Adds an extra file to the assets, which contains a list of | 1437 # write_asset_list: Adds an extra file to the assets, which contains a list of |
| 1437 # all other asset files. | 1438 # all other asset files. |
| 1438 # alternative_locale_resource_dep: The locale resource target which override s | 1439 # alternative_locale_resource_dep: The locale resource target which override s |
| 1439 # any exsting locale resources in dep graph. | 1440 # any exsting locale resources in dep graph. |
| 1440 # requires_sdk_api_level_23: If defined and true, the apk is intended for | 1441 # requires_sdk_api_level_23: If defined and true, the apk is intended for |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1464 # ":my_shared_lib", | 1465 # ":my_shared_lib", |
| 1465 # ] | 1466 # ] |
| 1466 # } | 1467 # } |
| 1467 template("android_apk") { | 1468 template("android_apk") { |
| 1468 set_sources_assignment_filter([]) | 1469 set_sources_assignment_filter([]) |
| 1469 forward_variables_from(invoker, [ "testonly" ]) | 1470 forward_variables_from(invoker, [ "testonly" ]) |
| 1470 | 1471 |
| 1471 assert(defined(invoker.final_apk_path) || defined(invoker.apk_name)) | 1472 assert(defined(invoker.final_apk_path) || defined(invoker.apk_name)) |
| 1472 assert(defined(invoker.android_manifest)) | 1473 assert(defined(invoker.android_manifest)) |
| 1473 gen_dir = "$target_gen_dir/$target_name" | 1474 gen_dir = "$target_gen_dir/$target_name" |
| 1474 base_path = "$gen_dir/$target_name" | 1475 _base_path = "$gen_dir/$target_name" |
| 1475 _build_config = "$target_gen_dir/$target_name.build_config" | 1476 _build_config = "$target_gen_dir/$target_name.build_config" |
| 1476 resources_zip_path = "$base_path.resources.zip" | 1477 resources_zip_path = "$_base_path.resources.zip" |
| 1477 _all_resources_zip_path = "$base_path.resources.all.zip" | 1478 _all_resources_zip_path = "$_base_path.resources.all.zip" |
| 1478 _jar_path = "$base_path.jar" | 1479 _jar_path = "$_base_path.jar" |
| 1479 _lib_dex_path = "$base_path.dex.jar" | 1480 _lib_dex_path = "$_base_path.dex.jar" |
| 1480 _rebased_lib_dex_path = rebase_path(_lib_dex_path, root_build_dir) | 1481 _rebased_lib_dex_path = rebase_path(_lib_dex_path, root_build_dir) |
| 1481 _template_name = target_name | 1482 _template_name = target_name |
| 1482 | 1483 |
| 1483 enable_multidex = | 1484 enable_multidex = |
| 1484 defined(invoker.enable_multidex) && invoker.enable_multidex | 1485 defined(invoker.enable_multidex) && invoker.enable_multidex |
| 1485 if (enable_multidex) { | 1486 if (enable_multidex) { |
| 1486 final_dex_path = "$gen_dir/classes.dex.zip" | 1487 _final_dex_path = "$gen_dir/classes.dex.zip" |
| 1487 } else { | 1488 } else { |
| 1488 final_dex_path = "$gen_dir/classes.dex" | 1489 _final_dex_path = "$gen_dir/classes.dex" |
| 1489 } | 1490 } |
| 1490 final_dex_target_name = "${_template_name}__final_dex" | 1491 _final_dex_target_name = "${_template_name}__final_dex" |
| 1491 | 1492 |
| 1492 _final_apk_path = "" | 1493 _final_apk_path = "" |
| 1493 if (defined(invoker.final_apk_path)) { | 1494 if (defined(invoker.final_apk_path)) { |
| 1494 _final_apk_path = invoker.final_apk_path | 1495 _final_apk_path = invoker.final_apk_path |
| 1495 } else if (defined(invoker.apk_name)) { | 1496 } else if (defined(invoker.apk_name)) { |
| 1496 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" | 1497 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" |
| 1497 } | 1498 } |
| 1498 _final_apk_path_no_ext_list = | 1499 _final_apk_path_no_ext_list = |
| 1499 process_file_template([ _final_apk_path ], | 1500 process_file_template([ _final_apk_path ], |
| 1500 "{{source_dir}}/{{source_name_part}}") | 1501 "{{source_dir}}/{{source_name_part}}") |
| 1501 _final_apk_path_no_ext = _final_apk_path_no_ext_list[0] | 1502 _final_apk_path_no_ext = _final_apk_path_no_ext_list[0] |
| 1502 assert(_final_apk_path_no_ext != "") # Mark as used. | 1503 assert(_final_apk_path_no_ext != "") # Mark as used. |
| 1503 | 1504 |
| 1504 _install_script_name = "install_$_template_name" | 1505 _install_script_name = "install_$_template_name" |
| 1505 if (defined(invoker.install_script_name)) { | 1506 if (defined(invoker.install_script_name)) { |
| 1506 _install_script_name = invoker.install_script_name | 1507 _install_script_name = invoker.install_script_name |
| 1507 } | 1508 } |
| 1508 _incremental_install_script_path = | 1509 _incremental_install_script_path = |
| 1509 "${root_out_dir}/bin/${_install_script_name}_incremental" | 1510 "${root_out_dir}/bin/${_install_script_name}_incremental" |
| 1510 | 1511 |
| 1511 _version_code = android_default_version_code | 1512 _version_code = android_default_version_code |
| 1512 if (defined(invoker.version_code)) { | 1513 if (defined(invoker.version_code)) { |
| 1513 _version_code = invoker.version_code | 1514 _version_code = invoker.version_code |
| 1514 } | 1515 } |
| 1515 | 1516 |
| 1516 _version_name = android_default_version_name | 1517 _version_name = android_default_version_name |
| 1517 if (defined(invoker.version_name)) { | 1518 if (defined(invoker.version_name)) { |
| 1518 _version_name = invoker.version_name | 1519 _version_name = invoker.version_name |
| 1519 } | 1520 } |
| 1521 | |
| 1520 _keystore_path = android_keystore_path | 1522 _keystore_path = android_keystore_path |
| 1521 _keystore_name = android_keystore_name | 1523 _keystore_name = android_keystore_name |
| 1522 _keystore_password = android_keystore_password | 1524 _keystore_password = android_keystore_password |
| 1523 | 1525 |
| 1524 if (defined(invoker.keystore_path)) { | 1526 if (defined(invoker.keystore_path)) { |
| 1525 _keystore_path = invoker.keystore_path | 1527 _keystore_path = invoker.keystore_path |
| 1526 _keystore_name = invoker.keystore_name | 1528 _keystore_name = invoker.keystore_name |
| 1527 _keystore_password = invoker.keystore_password | 1529 _keystore_password = invoker.keystore_password |
| 1528 } | 1530 } |
| 1529 | 1531 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1609 _create_density_splits = | 1611 _create_density_splits = |
| 1610 defined(invoker.create_density_splits) && invoker.create_density_splits | 1612 defined(invoker.create_density_splits) && invoker.create_density_splits |
| 1611 _create_language_splits = | 1613 _create_language_splits = |
| 1612 defined(invoker.language_splits) && invoker.language_splits != [] | 1614 defined(invoker.language_splits) && invoker.language_splits != [] |
| 1613 | 1615 |
| 1614 # Help GN understand that _create_abi_split is not unused (bug in GN). | 1616 # Help GN understand that _create_abi_split is not unused (bug in GN). |
| 1615 assert(_create_abi_split || true) | 1617 assert(_create_abi_split || true) |
| 1616 | 1618 |
| 1617 _proguard_enabled = | 1619 _proguard_enabled = |
| 1618 defined(invoker.proguard_enabled) && invoker.proguard_enabled | 1620 defined(invoker.proguard_enabled) && invoker.proguard_enabled |
| 1621 | |
| 1622 # We are creating an .apk just for instrumentation tests to run on. | |
| 1623 # This allows us to turn on optimizations for the 'real' .apk, optimizations which wouldn't cause | |
| 1624 # any real issues, but would break instrumentation tests due to inlining (an d possibly other harmless optimizations). | |
| 1625 # Thus, we make a copy of the 'real' apk and apply another proguard file to it. | |
| 1626 _create_apk_for_test = _proguard_enabled && !defined(invoker.apk_under_test) | |
| 1627 | |
| 1619 if (_proguard_enabled) { | 1628 if (_proguard_enabled) { |
| 1620 _proguard_output_jar_path = "$base_path.proguard.jar" | 1629 _proguard_output_jar_path = "$_base_path.proguard.jar" |
| 1630 } | |
| 1631 if (_create_apk_for_test) { | |
| 1632 _template_name_for_test = "${_template_name}_for_test" | |
| 1633 _proguard_output_jar_for_test_path = "${_base_path}_for_test.proguard.jar" | |
| 1634 _final_dex_for_test_path = "$gen_dir/classes_for_test.dex" | |
| 1635 | |
| 1636 assert( | |
| 1637 !defined(invoker.final_apk_path), | |
| 1638 "Setting final_apk_path for proguarded .apks is not yet implemented.") | |
| 1639 _final_apk_for_test_path = | |
| 1640 "$root_build_dir/apks/${invoker.apk_name}ForTest.apk" | |
| 1621 } | 1641 } |
| 1622 | 1642 |
| 1623 _emma_never_instrument = defined(invoker.testonly) && invoker.testonly | 1643 _emma_never_instrument = defined(invoker.testonly) && invoker.testonly |
| 1624 | 1644 |
| 1625 build_config_target = "${_template_name}__build_config" | 1645 build_config_target = "${_template_name}__build_config" |
| 1626 write_build_config(build_config_target) { | 1646 write_build_config(build_config_target) { |
| 1627 forward_variables_from(invoker, [ "apk_under_test" ]) | 1647 forward_variables_from(invoker, [ "apk_under_test" ]) |
| 1628 type = "android_apk" | 1648 type = "android_apk" |
| 1629 jar_path = _jar_path | 1649 jar_path = _jar_path |
| 1630 dex_path = final_dex_path | 1650 dex_path = _final_dex_path |
| 1631 apk_path = _final_apk_path | 1651 apk_path = _final_apk_path |
| 1652 if (_create_apk_for_test) { | |
| 1653 apk_for_test_path = _final_apk_for_test_path | |
| 1654 } | |
| 1632 incremental_apk_path = "${_final_apk_path_no_ext}_incremental.apk" | 1655 incremental_apk_path = "${_final_apk_path_no_ext}_incremental.apk" |
| 1633 incremental_install_script_path = _incremental_install_script_path | 1656 incremental_install_script_path = _incremental_install_script_path |
| 1634 resources_zip = resources_zip_path | 1657 resources_zip = resources_zip_path |
| 1635 build_config = _build_config | 1658 build_config = _build_config |
| 1636 android_manifest = _android_manifest | 1659 android_manifest = _android_manifest |
| 1637 | 1660 |
| 1638 deps = _android_manifest_deps | 1661 deps = _android_manifest_deps |
| 1639 | 1662 |
| 1640 if (defined(invoker.deps)) { | 1663 if (defined(invoker.deps)) { |
| 1641 possible_config_deps = invoker.deps | 1664 possible_config_deps = invoker.deps |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1660 # build the native libraries just to create the .build_config file. | 1683 # build the native libraries just to create the .build_config file. |
| 1661 # The dep is unnecessary since the runtime_deps file is created by gn gen | 1684 # The dep is unnecessary since the runtime_deps file is created by gn gen |
| 1662 # and the runtime_deps file is added to write_build_config.py's depfile. | 1685 # and the runtime_deps file is added to write_build_config.py's depfile. |
| 1663 if (_native_libs_deps != []) { | 1686 if (_native_libs_deps != []) { |
| 1664 shared_libraries_runtime_deps_file = _runtime_deps_file | 1687 shared_libraries_runtime_deps_file = _runtime_deps_file |
| 1665 } | 1688 } |
| 1666 } | 1689 } |
| 1667 | 1690 |
| 1668 _final_deps = [] | 1691 _final_deps = [] |
| 1669 | 1692 |
| 1670 _generated_proguard_config = "$base_path.resources.proguard.txt" | 1693 _generated_proguard_config = "$_base_path.resources.proguard.txt" |
| 1671 process_resources_target = "${_template_name}__process_resources" | 1694 process_resources_target = "${_template_name}__process_resources" |
| 1672 process_resources(process_resources_target) { | 1695 process_resources(process_resources_target) { |
| 1673 forward_variables_from(invoker, | 1696 forward_variables_from(invoker, |
| 1674 [ | 1697 [ |
| 1675 "alternative_android_sdk_jar", | 1698 "alternative_android_sdk_jar", |
| 1676 "android_aapt_path", | 1699 "android_aapt_path", |
| 1677 "app_as_shared_lib", | 1700 "app_as_shared_lib", |
| 1678 "include_all_resources", | 1701 "include_all_resources", |
| 1679 "shared_resources", | 1702 "shared_resources", |
| 1680 ]) | 1703 ]) |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1884 sources = [ | 1907 sources = [ |
| 1885 "$_proguard_output_jar_path.mapping", | 1908 "$_proguard_output_jar_path.mapping", |
| 1886 ] | 1909 ] |
| 1887 outputs = [ | 1910 outputs = [ |
| 1888 "$_final_apk_path.mapping", | 1911 "$_final_apk_path.mapping", |
| 1889 ] | 1912 ] |
| 1890 deps = [ | 1913 deps = [ |
| 1891 ":$_proguard_target", | 1914 ":$_proguard_target", |
| 1892 ] | 1915 ] |
| 1893 } | 1916 } |
| 1917 | |
| 1918 if (_create_apk_for_test) { | |
| 1919 _proguard_for_test_target = "${_template_name_for_test}__proguard" | |
| 1920 proguard(_proguard_for_test_target) { | |
|
agrieve
2016/07/07 01:32:12
I liked how the create_apk() template turned out.
smaier
2016/07/07 15:05:05
Done.
| |
| 1921 forward_variables_from(invoker, | |
| 1922 [ | |
| 1923 "alternative_android_sdk_jar", | |
| 1924 "proguard_jar_path", | |
| 1925 ]) | |
| 1926 deps = [ | |
| 1927 ":$build_config_target", | |
| 1928 ":$java_target", | |
| 1929 ":$process_resources_target", | |
| 1930 ] | |
| 1931 inputs = [ | |
| 1932 _build_config, | |
| 1933 _jar_path, | |
| 1934 ] + _proguard_configs | |
| 1935 | |
| 1936 output_jar_path = _proguard_output_jar_for_test_path | |
| 1937 | |
| 1938 # This Proguard flags file will apply only to tested apks - true | |
| 1939 # release apks are not affected. | |
| 1940 _proguard_configs += [ "//testing/android/proguard_for_test.flags" ] | |
| 1941 _rebased_proguard_configs = | |
| 1942 rebase_path(_proguard_configs, root_build_dir) | |
| 1943 args = [ | |
| 1944 "--proguard-configs=$_rebased_proguard_configs", | |
| 1945 "--input-paths=@FileArg($_rebased_build_config:proguard:input_paths) ", | |
| 1946 ] | |
| 1947 } | |
| 1948 } | |
| 1894 } else { | 1949 } else { |
| 1895 if (enable_multidex) { | 1950 if (enable_multidex) { |
| 1896 _dex_sources = [ _jar_path ] | 1951 _dex_sources = [ _jar_path ] |
| 1897 } else { | 1952 } else { |
| 1898 _dex_sources = [ _lib_dex_path ] | 1953 _dex_sources = [ _lib_dex_path ] |
| 1899 } | 1954 } |
| 1900 _dex_deps = [ ":$java_target" ] | 1955 _dex_deps = [ ":$java_target" ] |
| 1901 } | 1956 } |
| 1902 | 1957 |
| 1903 dex("$final_dex_target_name") { | 1958 dex("$_final_dex_target_name") { |
| 1904 deps = _dex_deps + [ ":$build_config_target" ] | 1959 deps = _dex_deps + [ ":$build_config_target" ] |
| 1905 inputs = [ | 1960 inputs = [ |
| 1906 _build_config, | 1961 _build_config, |
| 1907 ] | 1962 ] |
| 1908 sources = _dex_sources | 1963 sources = _dex_sources |
| 1909 output = final_dex_path | 1964 output = _final_dex_path |
| 1910 | 1965 |
| 1911 # All deps are already included in _dex_sources when proguard is used. | 1966 # All deps are already included in _dex_sources when proguard is used. |
| 1912 if (!_proguard_enabled) { | 1967 if (!_proguard_enabled) { |
| 1913 if (enable_multidex) { | 1968 if (enable_multidex) { |
| 1914 _dex_arg_key = "${_rebased_build_config}:dist_jar:dependency_jars" | 1969 _dex_arg_key = "${_rebased_build_config}:dist_jar:dependency_jars" |
| 1915 } else { | 1970 } else { |
| 1916 _dex_arg_key = | 1971 _dex_arg_key = |
| 1917 "${_rebased_build_config}:final_dex:dependency_dex_files" | 1972 "${_rebased_build_config}:final_dex:dependency_dex_files" |
| 1918 } | 1973 } |
| 1919 args = [ "--inputs=@FileArg($_dex_arg_key)" ] | 1974 args = [ "--inputs=@FileArg($_dex_arg_key)" ] |
| 1920 } | 1975 } |
| 1921 } | 1976 } |
| 1922 | 1977 |
| 1978 if (_create_apk_for_test) { | |
| 1979 _final_dex_for_test_target_name = "${_final_dex_target_name}_for_test" | |
| 1980 dex("$_final_dex_for_test_target_name") { | |
| 1981 deps = [ | |
| 1982 ":$_proguard_for_test_target", | |
| 1983 ":$build_config_target", | |
| 1984 ] | |
| 1985 inputs = [ | |
| 1986 _build_config, | |
| 1987 ] | |
| 1988 sources = [ | |
| 1989 _proguard_output_jar_for_test_path, | |
| 1990 ] | |
| 1991 output = _final_dex_for_test_path | |
| 1992 } | |
| 1993 } | |
| 1994 | |
| 1923 _native_libs_file_arg_dep = ":$build_config_target" | 1995 _native_libs_file_arg_dep = ":$build_config_target" |
| 1924 _native_libs_file_arg = "@FileArg($_rebased_build_config:native:libraries)" | 1996 _native_libs_file_arg = "@FileArg($_rebased_build_config:native:libraries)" |
| 1925 | 1997 |
| 1926 if (_native_libs_deps != [] && _enable_relocation_packing) { | 1998 if (_native_libs_deps != [] && _enable_relocation_packing) { |
| 1927 _prepare_native_target_name = "${_template_name}__prepare_native" | 1999 _prepare_native_target_name = "${_template_name}__prepare_native" |
| 1928 _native_libs_dir = "$gen_dir/packed-libs" | 2000 _native_libs_dir = "$gen_dir/packed-libs" |
| 1929 _native_libs_json = "$gen_dir/packed-libs/filelist.json" | 2001 _native_libs_json = "$gen_dir/packed-libs/filelist.json" |
| 1930 _rebased_native_libs_json = rebase_path(_native_libs_json, root_build_dir) | 2002 _rebased_native_libs_json = rebase_path(_native_libs_json, root_build_dir) |
| 1931 | 2003 |
| 1932 _native_libs_file_arg_dep = ":$_prepare_native_target_name" | 2004 _native_libs_file_arg_dep = ":$_prepare_native_target_name" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1984 if (_use_chromium_linker) { | 2056 if (_use_chromium_linker) { |
| 1985 _extra_native_libs = | 2057 _extra_native_libs = |
| 1986 [ "$root_shlib_dir/libchromium_android_linker$shlib_extension" ] | 2058 [ "$root_shlib_dir/libchromium_android_linker$shlib_extension" ] |
| 1987 _extra_native_libs_deps += | 2059 _extra_native_libs_deps += |
| 1988 [ "//base/android/linker:chromium_android_linker" ] | 2060 [ "//base/android/linker:chromium_android_linker" ] |
| 1989 } | 2061 } |
| 1990 } | 2062 } |
| 1991 if (defined(invoker.loadable_modules) && invoker.loadable_modules != []) { | 2063 if (defined(invoker.loadable_modules) && invoker.loadable_modules != []) { |
| 1992 _extra_native_libs_even_when_incremental += invoker.loadable_modules | 2064 _extra_native_libs_even_when_incremental += invoker.loadable_modules |
| 1993 } | 2065 } |
| 2066 assert(_extra_native_libs_even_when_incremental == [] || | |
|
agrieve
2016/07/07 01:32:12
nit: move below comment.
smaier
2016/07/07 15:05:05
Done.
| |
| 2067 _extra_native_libs_even_when_incremental != []) # Mark as used. | |
| 2068 | |
| 2069 # These assertions are to mark variables as used that will be used by create _main_apk, | |
| 2070 # since GN doesn't recognize they are being used. See crbug.com/395883. | |
| 2071 assert(!defined(invoker.extensions_to_not_compress) || | |
| 2072 invoker.extensions_to_not_compress != "") # Mark as used. | |
| 2073 assert(!defined(invoker.uncompress_shared_libraries) || | |
| 2074 invoker.uncompress_shared_libraries == true || | |
| 2075 invoker.uncompress_shared_libraries == false) # Mark as used. | |
| 2076 assert(!defined(invoker.page_align_shared_libraries) || | |
| 2077 invoker.page_align_shared_libraries == true || | |
| 2078 invoker.page_align_shared_libraries == false) # Mark as used. | |
| 2079 assert(_version_code != "") # Mark as used. | |
| 2080 assert(_version_code != "") # Mark as used. | |
| 2081 assert(_version_name != "") # Mark as used. | |
| 2082 assert(_keystore_path != "") # Mark as used. | |
| 2083 assert(_keystore_name != "") # Mark as used. | |
| 2084 assert(_keystore_password != "") # Mark as used. | |
| 2085 template("create_main_apk") { | |
| 2086 create_apk(target_name) { | |
| 2087 _parent_invoker = invoker.invoker | |
|
jbudorick
2016/07/07 01:48:52
:| I'm not crazy about the double invoker thing --
agrieve
2016/07/07 13:37:57
Hmm, I suggested using invoker.invoker and think i
smaier
2016/07/07 15:05:04
Done.
| |
| 2088 forward_variables_from(invoker, | |
| 2089 [ | |
| 2090 "apk_path", | |
| 2091 "base_path", | |
| 2092 "dex_path", | |
| 2093 ]) | |
| 2094 | |
| 2095 forward_variables_from(_parent_invoker, | |
| 2096 [ | |
| 2097 "alternative_android_sdk_jar", | |
| 2098 "android_aapt_path", | |
| 2099 "app_as_shared_lib", | |
| 2100 "deps", | |
| 2101 "extensions_to_not_compress", | |
| 2102 "language_splits", | |
| 2103 "native_lib_placeholders", | |
| 2104 "page_align_shared_libraries", | |
| 2105 "public_deps", | |
| 2106 "secondary_native_libs", | |
| 2107 "shared_resources", | |
| 2108 "uncompress_shared_libraries", | |
| 2109 "write_asset_list", | |
| 2110 ]) | |
| 2111 if (!defined(deps)) { | |
| 2112 deps = [] | |
| 2113 } | |
| 2114 | |
| 2115 # This target generates the input file _all_resources_zip_path. | |
| 2116 deps += _android_manifest_deps + [ | |
| 2117 ":$build_config_target", | |
| 2118 ":$process_resources_target", | |
| 2119 invoker.dex_target, | |
| 2120 ] | |
| 2121 android_manifest = _android_manifest | |
| 2122 assets_build_config = _build_config | |
| 2123 resources_zip = _all_resources_zip_path | |
| 2124 load_library_from_apk = _load_library_from_apk | |
| 2125 create_density_splits = _create_density_splits | |
| 2126 emma_instrument = emma_coverage && !_emma_never_instrument | |
| 2127 | |
| 2128 if (!defined(extensions_to_not_compress)) { | |
| 2129 # Allow icu data, v8 snapshots, and pak files to be loaded directly fr om | |
| 2130 # the .apk. | |
| 2131 # Note: These are actually suffix matches, not necessarily extensions. | |
| 2132 extensions_to_not_compress = ".dat,.bin,.pak" | |
| 2133 } | |
| 2134 | |
| 2135 version_code = _version_code | |
| 2136 version_name = _version_name | |
| 2137 | |
| 2138 keystore_name = _keystore_name | |
| 2139 keystore_path = _keystore_path | |
| 2140 keystore_password = _keystore_password | |
| 2141 | |
| 2142 # Incremental apk does not use native libs nor final dex. | |
| 2143 incremental_deps = deps + _android_manifest_deps + [ | |
| 2144 ":$build_config_target", | |
| 2145 ":$process_resources_target", | |
| 2146 ] | |
| 2147 if ((_native_libs_deps != [] || | |
| 2148 _extra_native_libs_even_when_incremental != []) && | |
| 2149 !_create_abi_split) { | |
| 2150 deps += _native_libs_deps + _extra_native_libs_deps + | |
| 2151 _extra_native_libs_even_when_incremental_deps + | |
| 2152 [ _native_libs_file_arg_dep ] | |
| 2153 native_libs_filearg = _native_libs_file_arg | |
| 2154 native_libs = _extra_native_libs | |
| 2155 native_libs_even_when_incremental = | |
| 2156 _extra_native_libs_even_when_incremental | |
| 2157 } | |
| 2158 } | |
| 2159 } | |
| 1994 | 2160 |
| 1995 _final_deps += [ ":${_template_name}__create" ] | 2161 _final_deps += [ ":${_template_name}__create" ] |
| 1996 create_apk("${_template_name}__create") { | 2162 create_main_apk("${_template_name}__create") { |
| 1997 forward_variables_from(invoker, | 2163 apk_path = _final_apk_path |
| 1998 [ | 2164 base_path = _base_path |
| 1999 "alternative_android_sdk_jar", | 2165 dex_path = _final_dex_path |
| 2000 "android_aapt_path", | 2166 dex_target = ":$_final_dex_target_name" |
| 2001 "app_as_shared_lib", | 2167 } |
| 2002 "deps", | 2168 |
| 2003 "extensions_to_not_compress", | 2169 if (_create_apk_for_test) { |
| 2004 "language_splits", | 2170 # We are going to create a second apk, very similiar to the above |
| 2005 "page_align_shared_libraries", | 2171 # create_apk("${_template_name}__create"), but with this one being an |
| 2006 "public_deps", | 2172 # externally visible rule which will build an .apk with the additional |
| 2007 "secondary_native_libs", | 2173 # test-only proguard flags. |
| 2008 "shared_resources", | 2174 create_main_apk("${_template_name_for_test}") { |
| 2009 "uncompress_shared_libraries", | 2175 apk_path = _final_apk_for_test_path |
| 2010 "write_asset_list", | 2176 base_path = _base_path + "_for_test" |
| 2011 ]) | 2177 dex_path = _final_dex_for_test_path |
| 2012 if (!defined(deps)) { | 2178 dex_target = ":$_final_dex_for_test_target_name" |
| 2013 deps = [] | |
| 2014 } | 2179 } |
| 2015 apk_path = _final_apk_path | |
| 2016 android_manifest = _android_manifest | |
| 2017 assets_build_config = _build_config | |
| 2018 resources_zip = _all_resources_zip_path | |
| 2019 dex_path = final_dex_path | |
| 2020 load_library_from_apk = _load_library_from_apk | |
| 2021 create_density_splits = _create_density_splits | |
| 2022 emma_instrument = emma_coverage && !_emma_never_instrument | |
| 2023 | |
| 2024 if (!defined(extensions_to_not_compress)) { | |
| 2025 # Allow icu data, v8 snapshots, and pak files to be loaded directly from | |
| 2026 # the .apk. | |
| 2027 # Note: These are actually suffix matches, not necessarily extensions. | |
| 2028 extensions_to_not_compress = ".dat,.bin,.pak" | |
| 2029 } | |
| 2030 | |
| 2031 version_code = _version_code | |
| 2032 version_name = _version_name | |
| 2033 | |
| 2034 keystore_name = _keystore_name | |
| 2035 keystore_path = _keystore_path | |
| 2036 keystore_password = _keystore_password | |
| 2037 | |
| 2038 # Incremental apk does not use native libs nor final dex. | |
| 2039 incremental_deps = deps + _android_manifest_deps + [ | |
| 2040 ":$build_config_target", | |
| 2041 ":$process_resources_target", | |
| 2042 ] | |
| 2043 | |
| 2044 # This target generates the input file _all_resources_zip_path. | |
| 2045 deps += _android_manifest_deps + [ | |
| 2046 ":$build_config_target", | |
| 2047 ":$process_resources_target", | |
| 2048 ":$final_dex_target_name", | |
| 2049 ] | |
| 2050 | |
| 2051 if ((_native_libs_deps != [] || | |
| 2052 _extra_native_libs_even_when_incremental != []) && | |
| 2053 !_create_abi_split) { | |
| 2054 deps += _native_libs_deps + _extra_native_libs_deps + | |
| 2055 _extra_native_libs_even_when_incremental_deps + | |
| 2056 [ _native_libs_file_arg_dep ] | |
| 2057 native_libs_filearg = _native_libs_file_arg | |
| 2058 native_libs = _extra_native_libs | |
| 2059 native_libs_even_when_incremental = | |
| 2060 _extra_native_libs_even_when_incremental | |
| 2061 } | |
| 2062 | |
| 2063 # Placeholders necessary for some older devices. | |
| 2064 # http://crbug.com/395038 | |
| 2065 forward_variables_from(invoker, [ "native_lib_placeholders" ]) | |
| 2066 } | 2180 } |
| 2067 | 2181 |
| 2068 if ((_native_libs_deps != [] || | 2182 if ((_native_libs_deps != [] || |
| 2069 _extra_native_libs_even_when_incremental != []) && _create_abi_split) { | 2183 _extra_native_libs_even_when_incremental != []) && _create_abi_split) { |
| 2070 _manifest_rule = | 2184 _manifest_rule = |
| 2071 "${_template_name}__split_manifest_abi_${android_app_abi}" | 2185 "${_template_name}__split_manifest_abi_${android_app_abi}" |
| 2072 generate_split_manifest(_manifest_rule) { | 2186 generate_split_manifest(_manifest_rule) { |
| 2073 main_manifest = _android_manifest | 2187 main_manifest = _android_manifest |
| 2074 out_manifest = | 2188 out_manifest = |
| 2075 "$gen_dir/split-manifests/${android_app_abi}/AndroidManifest.xml" | 2189 "$gen_dir/split-manifests/${android_app_abi}/AndroidManifest.xml" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2306 | 2420 |
| 2307 group(target_name) { | 2421 group(target_name) { |
| 2308 public_deps = [ | 2422 public_deps = [ |
| 2309 ":$_apk_target_name", | 2423 ":$_apk_target_name", |
| 2310 ":$_test_runner_target_name", | 2424 ":$_test_runner_target_name", |
| 2311 | 2425 |
| 2312 # Required by test runner to enumerate test list. | 2426 # Required by test runner to enumerate test list. |
| 2313 ":${_apk_target_name}_dist_ijar", | 2427 ":${_apk_target_name}_dist_ijar", |
| 2314 ] | 2428 ] |
| 2315 if (defined(invoker.apk_under_test)) { | 2429 if (defined(invoker.apk_under_test)) { |
| 2316 public_deps += [ invoker.apk_under_test ] | 2430 if (defined(invoker.proguard_enabled) && invoker.proguard_enabled) { |
| 2431 public_deps += [ "${invoker.apk_under_test}_for_test" ] | |
| 2432 } else { | |
| 2433 public_deps += [ invoker.apk_under_test ] | |
| 2434 } | |
| 2317 } | 2435 } |
| 2318 if (defined(invoker.isolate_file)) { | 2436 if (defined(invoker.isolate_file)) { |
| 2319 isolate_values = exec_script("//build/gypi_to_gn.py", | 2437 isolate_values = exec_script("//build/gypi_to_gn.py", |
| 2320 [ | 2438 [ |
| 2321 rebase_path(invoker.isolate_file), | 2439 rebase_path(invoker.isolate_file), |
| 2322 "--replace", | 2440 "--replace", |
| 2323 "<(DEPTH)=/", | 2441 "<(DEPTH)=/", |
| 2324 ], | 2442 ], |
| 2325 "scope", | 2443 "scope", |
| 2326 [ invoker.isolate_file ]) | 2444 [ invoker.isolate_file ]) |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2559 android_library(target_name) { | 2677 android_library(target_name) { |
| 2560 chromium_code = false | 2678 chromium_code = false |
| 2561 java_files = [] | 2679 java_files = [] |
| 2562 srcjar_deps = [ ":${_template_name}__protoc_java" ] | 2680 srcjar_deps = [ ":${_template_name}__protoc_java" ] |
| 2563 deps = [ | 2681 deps = [ |
| 2564 "//third_party/android_protobuf:protobuf_nano_javalib", | 2682 "//third_party/android_protobuf:protobuf_nano_javalib", |
| 2565 ] | 2683 ] |
| 2566 } | 2684 } |
| 2567 } | 2685 } |
| 2568 } | 2686 } |
| OLD | NEW |