Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1554)

Side by Side Diff: build/config/android/rules.gni

Issue 2319273002: Make secondary abi work for component build (Closed)
Patch Set: add missing dep Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/config/dcheck_always_on.gni") 7 import("//build/config/dcheck_always_on.gni")
8 import("//build/toolchain/toolchain.gni") 8 import("//build/toolchain/toolchain.gni")
9 9
10 assert(is_android) 10 assert(is_android)
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 # * dependencies of this .so are not automatically included 1413 # * dependencies of this .so are not automatically included
1414 # * ".cr.so" is never added 1414 # * ".cr.so" is never added
1415 # * they are not side-loaded for _incremental targets. 1415 # * they are not side-loaded for _incremental targets.
1416 # * load_library_from_apk, use_chromium_linker, 1416 # * load_library_from_apk, use_chromium_linker,
1417 # and enable_relocation_packing do not apply 1417 # and enable_relocation_packing do not apply
1418 # Use this instead of shared_libraries when you are going to load the libr ary 1418 # Use this instead of shared_libraries when you are going to load the libr ary
1419 # conditionally, and only when shared_libraries doesn't work for you. 1419 # conditionally, and only when shared_libraries doesn't work for you.
1420 # shared_libraries: List shared_library targets to bundle. If these 1420 # shared_libraries: List shared_library targets to bundle. If these
1421 # libraries depend on other shared_library targets, those dependencies wil l 1421 # libraries depend on other shared_library targets, those dependencies wil l
1422 # also be included in the apk (e.g. for is_component_build). 1422 # also be included in the apk (e.g. for is_component_build).
1423 # secondary_abi_shared_libraries: secondary abi shared_library targets to
1424 # bundle. If these libraries depend on other shared_library targets, those
1425 # dependencies will also be included in the apk (e.g. for is_component_bui ld).
1423 # native_lib_placeholders: List of placeholder filenames to add to the apk 1426 # native_lib_placeholders: List of placeholder filenames to add to the apk
1424 # (optional). 1427 # (optional).
1425 # apk_under_test: For an instrumentation test apk, this is the target of the 1428 # apk_under_test: For an instrumentation test apk, this is the target of the
1426 # tested apk. 1429 # tested apk.
1427 # include_all_resources - If true include all resource IDs in all generated 1430 # include_all_resources - If true include all resource IDs in all generated
1428 # R.java files. 1431 # R.java files.
1429 # testonly: Marks this target as "test-only". 1432 # testonly: Marks this target as "test-only".
1430 # write_asset_list: Adds an extra file to the assets, which contains a list of 1433 # write_asset_list: Adds an extra file to the assets, which contains a list of
1431 # all other asset files. 1434 # all other asset files.
1432 # alternative_locale_resource_dep: The locale resource target which override s 1435 # alternative_locale_resource_dep: The locale resource target which override s
1433 # any exsting locale resources in dep graph. 1436 # any exsting locale resources in dep graph.
1434 # requires_sdk_api_level_23: If defined and true, the apk is intended for 1437 # requires_sdk_api_level_23: If defined and true, the apk is intended for
1435 # installation only on Android M or later. In these releases the system 1438 # installation only on Android M or later. In these releases the system
1436 # linker does relocation unpacking, so we can enable it unconditionally. 1439 # linker does relocation unpacking, so we can enable it unconditionally.
1437 # secondary_native_libs: The path of native libraries for secondary app abi. 1440 # secondary_native_libs (deprecated): The path of native libraries for secon dary
1441 # app abi.
1438 # run_findbugs_override: Forces run_findbugs on or off. If undefined, the 1442 # run_findbugs_override: Forces run_findbugs on or off. If undefined, the
1439 # default will use the build arg run_findbugs. 1443 # default will use the build arg run_findbugs.
1440 # proguard_jar_path: The path to proguard.jar you wish to use. If undefined, 1444 # proguard_jar_path: The path to proguard.jar you wish to use. If undefined,
1441 # the proguard used will be the checked in one in //third_party/proguard. 1445 # the proguard used will be the checked in one in //third_party/proguard.
1442 # 1446 #
1443 # Example 1447 # Example
1444 # android_apk("foo_apk") { 1448 # android_apk("foo_apk") {
1445 # android_manifest = "AndroidManifest.xml" 1449 # android_manifest = "AndroidManifest.xml"
1446 # java_files = [ 1450 # java_files = [
1447 # "android/org/chromium/foo/FooApplication.java", 1451 # "android/org/chromium/foo/FooApplication.java",
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 "or requires_sdk_api_level_23") 1547 "or requires_sdk_api_level_23")
1544 } 1548 }
1545 if (_load_library_from_apk) { 1549 if (_load_library_from_apk) {
1546 assert(_use_chromium_linker || _requires_sdk_api_level_23, 1550 assert(_use_chromium_linker || _requires_sdk_api_level_23,
1547 "load_library_from_apk requires use_chromium_linker " + 1551 "load_library_from_apk requires use_chromium_linker " +
1548 "or requires_sdk_api_level_23") 1552 "or requires_sdk_api_level_23")
1549 } 1553 }
1550 1554
1551 # The dependency that makes the chromium linker, if any is needed. 1555 # The dependency that makes the chromium linker, if any is needed.
1552 _native_libs_deps = [] 1556 _native_libs_deps = []
1557 _shared_libraries_is_valid =
1558 defined(invoker.shared_libraries) && invoker.shared_libraries != []
1559 _secondary_abi_native_libs_deps = []
1560 assert(_secondary_abi_native_libs_deps == []) # mark as used.
1561 _secondary_abi_shared_libraries_is_valid =
1562 defined(invoker.secondary_abi_shared_libraries) &&
1563 invoker.secondary_abi_shared_libraries != []
1553 1564
1554 if (defined(invoker.shared_libraries) && invoker.shared_libraries != []) { 1565 if (is_component_build || is_asan) {
1555 _native_libs_deps += invoker.shared_libraries 1566 if (_shared_libraries_is_valid) {
1556
1557 if (is_component_build || is_asan) {
1558 _native_libs_deps += [ "//build/android:cpplib_stripped" ] 1567 _native_libs_deps += [ "//build/android:cpplib_stripped" ]
1559 } 1568 }
1569 if (_secondary_abi_shared_libraries_is_valid) {
1570 _secondary_abi_native_libs_deps += [ "//build/android:cpplib_stripped($a ndroid_secondary_abi_toolchain)" ]
1571 }
1572 }
1573
1574 if (_shared_libraries_is_valid) {
1575 _native_libs_deps += invoker.shared_libraries
1560 1576
1561 # To determine the filenames of all dependent shared libraries, write the 1577 # To determine the filenames of all dependent shared libraries, write the
1562 # runtime deps of |shared_libraries| to a file during "gn gen". 1578 # runtime deps of |shared_libraries| to a file during "gn gen".
1563 # write_build_config.py will then grep this file for *.so to obtain the 1579 # write_build_config.py will then grep this file for *.so to obtain the
1564 # complete list. 1580 # complete list.
1565 _runtime_deps_file = 1581 _runtime_deps_file =
1566 "$target_gen_dir/${_template_name}.native.runtimedeps" 1582 "$target_gen_dir/${_template_name}.native.runtimedeps"
1567 group("${_template_name}__runtime_deps") { 1583 group("${_template_name}__runtime_deps") {
1568 deps = _native_libs_deps 1584 deps = _native_libs_deps
1569 write_runtime_deps = _runtime_deps_file 1585 write_runtime_deps = _runtime_deps_file
1570 } 1586 }
1571 1587
1572 _native_lib_version_rule = "" 1588 _native_lib_version_rule = ""
1573 if (defined(invoker.native_lib_version_rule)) { 1589 if (defined(invoker.native_lib_version_rule)) {
1574 _native_lib_version_rule = invoker.native_lib_version_rule 1590 _native_lib_version_rule = invoker.native_lib_version_rule
1575 } 1591 }
1576 _native_lib_version_arg = "\"\"" 1592 _native_lib_version_arg = "\"\""
1577 if (defined(invoker.native_lib_version_arg)) { 1593 if (defined(invoker.native_lib_version_arg)) {
1578 _native_lib_version_arg = invoker.native_lib_version_arg 1594 _native_lib_version_arg = invoker.native_lib_version_arg
1579 } 1595 }
1580 } 1596 }
1581 1597
1598 if (_secondary_abi_shared_libraries_is_valid) {
1599 _secondary_abi_native_libs_deps += invoker.secondary_abi_shared_libraries
1600
1601 # To determine the filenames of all dependent shared libraries, write the
1602 # runtime deps of |shared_libraries| to a file during "gn gen".
1603 # write_build_config.py will then grep this file for *.so to obtain the
1604 # complete list.
1605 _secondary_abi_runtime_deps_file =
1606 "$target_gen_dir/${_template_name}.secondary.abi.native.runtimedeps"
1607 group("${_template_name}_secondary_abi__runtime_deps") {
1608 deps = _secondary_abi_native_libs_deps
1609 write_runtime_deps = _secondary_abi_runtime_deps_file
1610 }
1611 }
1612
1582 if (defined(invoker.deps)) { 1613 if (defined(invoker.deps)) {
1583 set_sources_assignment_filter([ "*manifest*" ]) 1614 set_sources_assignment_filter([ "*manifest*" ])
1584 sources = invoker.deps 1615 sources = invoker.deps
1585 set_sources_assignment_filter([]) 1616 set_sources_assignment_filter([])
1586 if (sources != invoker.deps) { 1617 if (sources != invoker.deps) {
1587 _bad_deps = invoker.deps - sources 1618 _bad_deps = invoker.deps - sources
1588 assert( 1619 assert(
1589 false, 1620 false,
1590 "Possible manifest-generating dep found in deps. Use android_manifes t_dep for this instead. Found: $_bad_deps") 1621 "Possible manifest-generating dep found in deps. Use android_manifes t_dep for this instead. Found: $_bad_deps")
1591 } 1622 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 proguard_info = "$_proguard_output_jar_path.info" 1681 proguard_info = "$_proguard_output_jar_path.info"
1651 } 1682 }
1652 1683
1653 # Don't depend on the runtime_deps target in order to avoid having to 1684 # Don't depend on the runtime_deps target in order to avoid having to
1654 # build the native libraries just to create the .build_config file. 1685 # build the native libraries just to create the .build_config file.
1655 # The dep is unnecessary since the runtime_deps file is created by gn gen 1686 # The dep is unnecessary since the runtime_deps file is created by gn gen
1656 # and the runtime_deps file is added to write_build_config.py's depfile. 1687 # and the runtime_deps file is added to write_build_config.py's depfile.
1657 if (_native_libs_deps != []) { 1688 if (_native_libs_deps != []) {
1658 shared_libraries_runtime_deps_file = _runtime_deps_file 1689 shared_libraries_runtime_deps_file = _runtime_deps_file
1659 } 1690 }
1691 if (_secondary_abi_native_libs_deps != []) {
1692 secondary_abi_shared_libraries_runtime_deps_file =
1693 _secondary_abi_runtime_deps_file
1694 }
1660 } 1695 }
1661 1696
1662 _final_deps = [] 1697 _final_deps = []
1663 1698
1664 _generated_proguard_config = "$base_path.resources.proguard.txt" 1699 _generated_proguard_config = "$base_path.resources.proguard.txt"
1665 process_resources_target = "${_template_name}__process_resources" 1700 process_resources_target = "${_template_name}__process_resources"
1666 process_resources(process_resources_target) { 1701 process_resources(process_resources_target) {
1667 forward_variables_from(invoker, 1702 forward_variables_from(invoker,
1668 [ 1703 [
1669 "alternative_android_sdk_jar", 1704 "alternative_android_sdk_jar",
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 } else { 1952 } else {
1918 _dex_arg_key = 1953 _dex_arg_key =
1919 "${_rebased_build_config}:final_dex:dependency_dex_files" 1954 "${_rebased_build_config}:final_dex:dependency_dex_files"
1920 } 1955 }
1921 args = [ "--inputs=@FileArg($_dex_arg_key)" ] 1956 args = [ "--inputs=@FileArg($_dex_arg_key)" ]
1922 } 1957 }
1923 } 1958 }
1924 1959
1925 _native_libs_file_arg_dep = ":$build_config_target" 1960 _native_libs_file_arg_dep = ":$build_config_target"
1926 _native_libs_file_arg = "@FileArg($_rebased_build_config:native:libraries)" 1961 _native_libs_file_arg = "@FileArg($_rebased_build_config:native:libraries)"
1962 _secondary_abi_native_libs_file_arg_dep = ":$build_config_target"
1963 _secondary_abi_native_libs_file_arg =
1964 "@FileArg($_rebased_build_config:native:secondary_abi_libraries)"
1965 assert(_secondary_abi_native_libs_file_arg != "" &&
1966 _secondary_abi_native_libs_file_arg_dep != "") # Mark as used.
1927 1967
1928 if (_native_libs_deps != [] && _enable_relocation_packing) { 1968 if (_native_libs_deps != [] && _enable_relocation_packing) {
1929 _prepare_native_target_name = "${_template_name}__prepare_native" 1969 _prepare_native_target_name = "${_template_name}__prepare_native"
1930 _native_libs_dir = "$gen_dir/packed-libs"
1931 _native_libs_json = "$gen_dir/packed-libs/filelist.json" 1970 _native_libs_json = "$gen_dir/packed-libs/filelist.json"
1932 _rebased_native_libs_json = rebase_path(_native_libs_json, root_build_dir) 1971 _rebased_native_libs_json = rebase_path(_native_libs_json, root_build_dir)
1933
1934 _native_libs_file_arg_dep = ":$_prepare_native_target_name" 1972 _native_libs_file_arg_dep = ":$_prepare_native_target_name"
1935 _native_libs_file_arg = "@FileArg($_rebased_native_libs_json:files)" 1973 _native_libs_file_arg = "@FileArg($_rebased_native_libs_json:files)"
1936 1974
1937 action(_prepare_native_target_name) { 1975 pack_relocation_section(_prepare_native_target_name) {
1938 forward_variables_from(invoker, 1976 forward_variables_from(invoker,
1939 [ 1977 [
1940 "deps", 1978 "deps",
1941 "public_deps", 1979 "public_deps",
1942 ]) 1980 ])
1943 script = "//build/android/gyp/pack_relocations.py" 1981 file_list_json = _native_libs_json
1944 depfile = "$target_gen_dir/$target_name.d" 1982 libraries_filearg =
1945 outputs = [ 1983 "@FileArg(${_rebased_build_config}:native:libraries)"
1946 _native_libs_json,
1947 ]
1948
1949 inputs = [ 1984 inputs = [
1950 _build_config, 1985 _build_config,
1951 ] 1986 ]
1952 1987
1953 deps += _native_libs_deps 1988 deps += _native_libs_deps
1954 deps += [ 1989 deps += [ ":$build_config_target" ]
1955 ":$build_config_target", 1990 }
1956 relocation_packer_target, 1991 if (_secondary_abi_native_libs_deps != []) {
1957 ] 1992 _prepare_native_target_name =
1993 "${_template_name}_secondary_abi__prepare_native"
1994 _native_libs_json =
1995 "$gen_dir/packed-libs/$android_secondary_abi_cpu/filelist.json"
1996 _rebased_native_libs_json =
1997 rebase_path(_native_libs_json, root_build_dir)
1998 _secondary_abi_native_libs_file_arg_dep =
1999 ":$_prepare_native_target_name"
2000 _secondary_abi_native_libs_file_arg =
2001 "@FileArg($_rebased_native_libs_json:files)"
1958 2002
1959 args = [ 2003 pack_relocation_section(_prepare_native_target_name) {
1960 "--depfile", 2004 forward_variables_from(invoker,
1961 rebase_path(depfile, root_build_dir), 2005 [
1962 "--enable-packing=1", 2006 "deps",
1963 "--android-pack-relocations", 2007 "public_deps",
1964 rebase_path(relocation_packer_exe, root_build_dir), 2008 ])
1965 "--stripped-libraries-dir", 2009 file_list_json = _native_libs_json
1966 rebase_path(root_build_dir, root_build_dir), 2010 libraries_filearg = "@FileArg(${_rebased_build_config}:native:secondar y_abi_libraries)"
1967 "--packed-libraries-dir", 2011 inputs = [
1968 rebase_path(_native_libs_dir, root_build_dir), 2012 _build_config,
1969 "--libraries=@FileArg(${_rebased_build_config}:native:libraries)", 2013 ]
1970 "--filelistjson=$_rebased_native_libs_json", 2014
1971 ] 2015 deps += _secondary_abi_native_libs_deps
2016 deps += [ ":$build_config_target" ]
2017 }
1972 } 2018 }
1973 } 2019 }
1974 2020
1975 _extra_native_libs = [] 2021 _extra_native_libs = []
1976 _extra_native_libs_deps = [] 2022 _extra_native_libs_deps = []
1977 _extra_native_libs_even_when_incremental = [] 2023 _extra_native_libs_even_when_incremental = []
1978 _extra_native_libs_even_when_incremental_deps = [] 2024 _extra_native_libs_even_when_incremental_deps = []
1979 assert(_extra_native_libs_even_when_incremental_deps == []) # Mark as used. 2025 assert(_extra_native_libs_even_when_incremental_deps == []) # Mark as used.
1980 if (_native_libs_deps != []) { 2026 if (_native_libs_deps != []) {
1981 # zipalign can't align gdb_server, don't pack gdbserver temporarily. 2027 # zipalign can't align gdb_server, don't pack gdbserver temporarily.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 !_create_abi_split) { 2102 !_create_abi_split) {
2057 deps += _native_libs_deps + _extra_native_libs_deps + 2103 deps += _native_libs_deps + _extra_native_libs_deps +
2058 _extra_native_libs_even_when_incremental_deps + 2104 _extra_native_libs_even_when_incremental_deps +
2059 [ _native_libs_file_arg_dep ] 2105 [ _native_libs_file_arg_dep ]
2060 native_libs_filearg = _native_libs_file_arg 2106 native_libs_filearg = _native_libs_file_arg
2061 native_libs = _extra_native_libs 2107 native_libs = _extra_native_libs
2062 native_libs_even_when_incremental = 2108 native_libs_even_when_incremental =
2063 _extra_native_libs_even_when_incremental 2109 _extra_native_libs_even_when_incremental
2064 } 2110 }
2065 2111
2112 if (_secondary_abi_native_libs_deps != [] && !_create_abi_split) {
2113 deps += _secondary_abi_native_libs_deps +
2114 [ _secondary_abi_native_libs_file_arg_dep ]
2115 secondary_abi_native_libs_filearg = _secondary_abi_native_libs_file_arg
2116 }
2117
2066 # Placeholders necessary for some older devices. 2118 # Placeholders necessary for some older devices.
2067 # http://crbug.com/395038 2119 # http://crbug.com/395038
2068 forward_variables_from(invoker, [ "native_lib_placeholders" ]) 2120 forward_variables_from(invoker, [ "native_lib_placeholders" ])
2069 } 2121 }
2070 2122
2071 if ((_native_libs_deps != [] || 2123 if ((_native_libs_deps != [] ||
2072 _extra_native_libs_even_when_incremental != []) && _create_abi_split) { 2124 _extra_native_libs_even_when_incremental != []) && _create_abi_split) {
2073 _manifest_rule = 2125 _manifest_rule =
2074 "${_template_name}__split_manifest_abi_${android_app_abi}" 2126 "${_template_name}__split_manifest_abi_${android_app_abi}"
2075 generate_split_manifest(_manifest_rule) { 2127 generate_split_manifest(_manifest_rule) {
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
2760 # because in practice they seem to contain classes required to be in the 2812 # because in practice they seem to contain classes required to be in the
2761 # classpath. 2813 # classpath.
2762 deps += _subjar_targets 2814 deps += _subjar_targets
2763 } 2815 }
2764 if (defined(_res_target_name)) { 2816 if (defined(_res_target_name)) {
2765 deps += [ ":$_res_target_name" ] 2817 deps += [ ":$_res_target_name" ]
2766 } 2818 }
2767 } 2819 }
2768 } 2820 }
2769 } 2821 }
OLDNEW
« build/config/android/internal_rules.gni ('K') | « build/config/android/internal_rules.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698