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

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

Issue 2335663002: Reland of Make secondary abi work for component build (Closed)
Patch Set: Delete rogue import and add comment to guard future additions 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
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 # 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.
5 import("//build/config/android/config.gni") 7 import("//build/config/android/config.gni")
6 import("//build/config/android/internal_rules.gni") 8 import("//build/config/android/internal_rules.gni")
7 import("//build/config/dcheck_always_on.gni") 9 import("//build/config/dcheck_always_on.gni")
8 import("//build/toolchain/toolchain.gni") 10 import("//build/toolchain/toolchain.gni")
9 11
10 assert(is_android) 12 assert(is_android)
11 13
12 # Creates a dist directory for a native executable. 14 # Creates a dist directory for a native executable.
13 # 15 #
14 # Running a native executable on a device requires all the shared library 16 # Running a native executable on a device requires all the shared library
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 rebase_path(root_out_dir, root_build_dir), 136 rebase_path(root_out_dir, root_build_dir),
135 ] 137 ]
136 if (defined(invoker.flag_name)) { 138 if (defined(invoker.flag_name)) {
137 args += [ "--flag-name=${invoker.flag_name}" ] 139 args += [ "--flag-name=${invoker.flag_name}" ]
138 } 140 }
139 } 141 }
140 } 142 }
141 143
142 if (enable_java_templates) { 144 if (enable_java_templates) {
143 import("//build/config/sanitizers/sanitizers.gni") 145 import("//build/config/sanitizers/sanitizers.gni")
144 import("//third_party/android_platform/config.gni")
145 import("//tools/grit/grit_rule.gni") 146 import("//tools/grit/grit_rule.gni")
146 147
147 # Declare a jni target 148 # Declare a jni target
148 # 149 #
149 # This target generates the native jni bindings for a set of .java files. 150 # This target generates the native jni bindings for a set of .java files.
150 # 151 #
151 # See base/android/jni_generator/jni_generator.py for more info about the 152 # See base/android/jni_generator/jni_generator.py for more info about the
152 # format of generating JNI bindings. 153 # format of generating JNI bindings.
153 # 154 #
154 # Variables 155 # Variables
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1417 # * dependencies of this .so are not automatically included 1418 # * dependencies of this .so are not automatically included
1418 # * ".cr.so" is never added 1419 # * ".cr.so" is never added
1419 # * they are not side-loaded for _incremental targets. 1420 # * they are not side-loaded for _incremental targets.
1420 # * load_library_from_apk, use_chromium_linker, 1421 # * load_library_from_apk, use_chromium_linker,
1421 # and enable_relocation_packing do not apply 1422 # and enable_relocation_packing do not apply
1422 # Use this instead of shared_libraries when you are going to load the libr ary 1423 # Use this instead of shared_libraries when you are going to load the libr ary
1423 # conditionally, and only when shared_libraries doesn't work for you. 1424 # conditionally, and only when shared_libraries doesn't work for you.
1424 # shared_libraries: List shared_library targets to bundle. If these 1425 # shared_libraries: List shared_library targets to bundle. If these
1425 # libraries depend on other shared_library targets, those dependencies wil l 1426 # libraries depend on other shared_library targets, those dependencies wil l
1426 # also be included in the apk (e.g. for is_component_build). 1427 # also be included in the apk (e.g. for is_component_build).
1428 # secondary_abi_shared_libraries: secondary abi shared_library targets to
1429 # bundle. If these libraries depend on other shared_library targets, those
1430 # dependencies will also be included in the apk (e.g. for is_component_bui ld).
1427 # native_lib_placeholders: List of placeholder filenames to add to the apk 1431 # native_lib_placeholders: List of placeholder filenames to add to the apk
1428 # (optional). 1432 # (optional).
1429 # apk_under_test: For an instrumentation test apk, this is the target of the 1433 # apk_under_test: For an instrumentation test apk, this is the target of the
1430 # tested apk. 1434 # tested apk.
1431 # include_all_resources - If true include all resource IDs in all generated 1435 # include_all_resources - If true include all resource IDs in all generated
1432 # R.java files. 1436 # R.java files.
1433 # testonly: Marks this target as "test-only". 1437 # testonly: Marks this target as "test-only".
1434 # write_asset_list: Adds an extra file to the assets, which contains a list of 1438 # write_asset_list: Adds an extra file to the assets, which contains a list of
1435 # all other asset files. 1439 # all other asset files.
1436 # alternative_locale_resource_dep: The locale resource target which override s 1440 # alternative_locale_resource_dep: The locale resource target which override s
1437 # any exsting locale resources in dep graph. 1441 # any exsting locale resources in dep graph.
1438 # requires_sdk_api_level_23: If defined and true, the apk is intended for 1442 # requires_sdk_api_level_23: If defined and true, the apk is intended for
1439 # installation only on Android M or later. In these releases the system 1443 # installation only on Android M or later. In these releases the system
1440 # linker does relocation unpacking, so we can enable it unconditionally. 1444 # linker does relocation unpacking, so we can enable it unconditionally.
1441 # secondary_native_libs: The path of native libraries for secondary app abi. 1445 # secondary_native_libs (deprecated): The path of native libraries for secon dary
1446 # app abi.
1442 # run_findbugs_override: Forces run_findbugs on or off. If undefined, the 1447 # run_findbugs_override: Forces run_findbugs on or off. If undefined, the
1443 # default will use the build arg run_findbugs. 1448 # default will use the build arg run_findbugs.
1444 # proguard_jar_path: The path to proguard.jar you wish to use. If undefined, 1449 # proguard_jar_path: The path to proguard.jar you wish to use. If undefined,
1445 # the proguard used will be the checked in one in //third_party/proguard. 1450 # the proguard used will be the checked in one in //third_party/proguard.
1446 # 1451 #
1447 # Example 1452 # Example
1448 # android_apk("foo_apk") { 1453 # android_apk("foo_apk") {
1449 # android_manifest = "AndroidManifest.xml" 1454 # android_manifest = "AndroidManifest.xml"
1450 # java_files = [ 1455 # java_files = [
1451 # "android/org/chromium/foo/FooApplication.java", 1456 # "android/org/chromium/foo/FooApplication.java",
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 "or requires_sdk_api_level_23") 1552 "or requires_sdk_api_level_23")
1548 } 1553 }
1549 if (_load_library_from_apk) { 1554 if (_load_library_from_apk) {
1550 assert(_use_chromium_linker || _requires_sdk_api_level_23, 1555 assert(_use_chromium_linker || _requires_sdk_api_level_23,
1551 "load_library_from_apk requires use_chromium_linker " + 1556 "load_library_from_apk requires use_chromium_linker " +
1552 "or requires_sdk_api_level_23") 1557 "or requires_sdk_api_level_23")
1553 } 1558 }
1554 1559
1555 # The dependency that makes the chromium linker, if any is needed. 1560 # The dependency that makes the chromium linker, if any is needed.
1556 _native_libs_deps = [] 1561 _native_libs_deps = []
1562 _shared_libraries_is_valid =
1563 defined(invoker.shared_libraries) && invoker.shared_libraries != []
1564 _secondary_abi_native_libs_deps = []
1565 assert(_secondary_abi_native_libs_deps == []) # mark as used.
1566 _secondary_abi_shared_libraries_is_valid =
1567 defined(invoker.secondary_abi_shared_libraries) &&
1568 invoker.secondary_abi_shared_libraries != []
1557 1569
1558 if (defined(invoker.shared_libraries) && invoker.shared_libraries != []) { 1570 if (is_component_build || is_asan) {
1559 _native_libs_deps += invoker.shared_libraries 1571 if (_shared_libraries_is_valid) {
1560
1561 if (is_component_build || is_asan) {
1562 _native_libs_deps += [ "//build/android:cpplib_stripped" ] 1572 _native_libs_deps += [ "//build/android:cpplib_stripped" ]
1563 } 1573 }
1574 if (_secondary_abi_shared_libraries_is_valid) {
1575 _secondary_abi_native_libs_deps += [ "//build/android:cpplib_stripped($a ndroid_secondary_abi_toolchain)" ]
1576 }
1577 }
1578
1579 if (_shared_libraries_is_valid) {
1580 _native_libs_deps += invoker.shared_libraries
1564 1581
1565 # To determine the filenames of all dependent shared libraries, write the 1582 # To determine the filenames of all dependent shared libraries, write the
1566 # runtime deps of |shared_libraries| to a file during "gn gen". 1583 # runtime deps of |shared_libraries| to a file during "gn gen".
1567 # write_build_config.py will then grep this file for *.so to obtain the 1584 # write_build_config.py will then grep this file for *.so to obtain the
1568 # complete list. 1585 # complete list.
1569 _runtime_deps_file = 1586 _runtime_deps_file =
1570 "$target_gen_dir/${_template_name}.native.runtimedeps" 1587 "$target_gen_dir/${_template_name}.native.runtimedeps"
1571 group("${_template_name}__runtime_deps") { 1588 group("${_template_name}__runtime_deps") {
1572 deps = _native_libs_deps 1589 deps = _native_libs_deps
1573 write_runtime_deps = _runtime_deps_file 1590 write_runtime_deps = _runtime_deps_file
1574 } 1591 }
1575 1592
1576 _native_lib_version_rule = "" 1593 _native_lib_version_rule = ""
1577 if (defined(invoker.native_lib_version_rule)) { 1594 if (defined(invoker.native_lib_version_rule)) {
1578 _native_lib_version_rule = invoker.native_lib_version_rule 1595 _native_lib_version_rule = invoker.native_lib_version_rule
1579 } 1596 }
1580 _native_lib_version_arg = "\"\"" 1597 _native_lib_version_arg = "\"\""
1581 if (defined(invoker.native_lib_version_arg)) { 1598 if (defined(invoker.native_lib_version_arg)) {
1582 _native_lib_version_arg = invoker.native_lib_version_arg 1599 _native_lib_version_arg = invoker.native_lib_version_arg
1583 } 1600 }
1584 } 1601 }
1585 1602
1603 if (_secondary_abi_shared_libraries_is_valid) {
1604 _secondary_abi_native_libs_deps += invoker.secondary_abi_shared_libraries
1605
1606 # To determine the filenames of all dependent shared libraries, write the
1607 # runtime deps of |shared_libraries| to a file during "gn gen".
1608 # write_build_config.py will then grep this file for *.so to obtain the
1609 # complete list.
1610 _secondary_abi_runtime_deps_file =
1611 "$target_gen_dir/${_template_name}.secondary.abi.native.runtimedeps"
1612 group("${_template_name}_secondary_abi__runtime_deps") {
1613 deps = _secondary_abi_native_libs_deps
1614 write_runtime_deps = _secondary_abi_runtime_deps_file
1615 }
1616 }
1617
1586 if (defined(invoker.deps)) { 1618 if (defined(invoker.deps)) {
1587 set_sources_assignment_filter([ "*manifest*" ]) 1619 set_sources_assignment_filter([ "*manifest*" ])
1588 sources = invoker.deps 1620 sources = invoker.deps
1589 set_sources_assignment_filter([]) 1621 set_sources_assignment_filter([])
1590 if (sources != invoker.deps) { 1622 if (sources != invoker.deps) {
1591 _bad_deps = invoker.deps - sources 1623 _bad_deps = invoker.deps - sources
1592 assert( 1624 assert(
1593 false, 1625 false,
1594 "Possible manifest-generating dep found in deps. Use android_manifes t_dep for this instead. Found: $_bad_deps") 1626 "Possible manifest-generating dep found in deps. Use android_manifes t_dep for this instead. Found: $_bad_deps")
1595 } 1627 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 proguard_info = "$_proguard_output_jar_path.info" 1686 proguard_info = "$_proguard_output_jar_path.info"
1655 } 1687 }
1656 1688
1657 # Don't depend on the runtime_deps target in order to avoid having to 1689 # Don't depend on the runtime_deps target in order to avoid having to
1658 # build the native libraries just to create the .build_config file. 1690 # build the native libraries just to create the .build_config file.
1659 # The dep is unnecessary since the runtime_deps file is created by gn gen 1691 # The dep is unnecessary since the runtime_deps file is created by gn gen
1660 # and the runtime_deps file is added to write_build_config.py's depfile. 1692 # and the runtime_deps file is added to write_build_config.py's depfile.
1661 if (_native_libs_deps != []) { 1693 if (_native_libs_deps != []) {
1662 shared_libraries_runtime_deps_file = _runtime_deps_file 1694 shared_libraries_runtime_deps_file = _runtime_deps_file
1663 } 1695 }
1696 if (_secondary_abi_native_libs_deps != []) {
1697 secondary_abi_shared_libraries_runtime_deps_file =
1698 _secondary_abi_runtime_deps_file
1699 }
1664 } 1700 }
1665 1701
1666 _final_deps = [] 1702 _final_deps = []
1667 1703
1668 _generated_proguard_config = "$base_path.resources.proguard.txt" 1704 _generated_proguard_config = "$base_path.resources.proguard.txt"
1669 process_resources_target = "${_template_name}__process_resources" 1705 process_resources_target = "${_template_name}__process_resources"
1670 process_resources(process_resources_target) { 1706 process_resources(process_resources_target) {
1671 forward_variables_from(invoker, 1707 forward_variables_from(invoker,
1672 [ 1708 [
1673 "alternative_android_sdk_jar", 1709 "alternative_android_sdk_jar",
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 } else { 1957 } else {
1922 _dex_arg_key = 1958 _dex_arg_key =
1923 "${_rebased_build_config}:final_dex:dependency_dex_files" 1959 "${_rebased_build_config}:final_dex:dependency_dex_files"
1924 } 1960 }
1925 args = [ "--inputs=@FileArg($_dex_arg_key)" ] 1961 args = [ "--inputs=@FileArg($_dex_arg_key)" ]
1926 } 1962 }
1927 } 1963 }
1928 1964
1929 _native_libs_file_arg_dep = ":$build_config_target" 1965 _native_libs_file_arg_dep = ":$build_config_target"
1930 _native_libs_file_arg = "@FileArg($_rebased_build_config:native:libraries)" 1966 _native_libs_file_arg = "@FileArg($_rebased_build_config:native:libraries)"
1967 _secondary_abi_native_libs_file_arg_dep = ":$build_config_target"
1968 _secondary_abi_native_libs_file_arg =
1969 "@FileArg($_rebased_build_config:native:secondary_abi_libraries)"
1970 assert(_secondary_abi_native_libs_file_arg != "" &&
1971 _secondary_abi_native_libs_file_arg_dep != "") # Mark as used.
1931 1972
1932 if (_native_libs_deps != [] && _enable_relocation_packing) { 1973 if (_native_libs_deps != [] && _enable_relocation_packing) {
1933 _prepare_native_target_name = "${_template_name}__prepare_native" 1974 _prepare_native_target_name = "${_template_name}__prepare_native"
1934 _native_libs_dir = "$gen_dir/packed-libs"
1935 _native_libs_json = "$gen_dir/packed-libs/filelist.json" 1975 _native_libs_json = "$gen_dir/packed-libs/filelist.json"
1936 _rebased_native_libs_json = rebase_path(_native_libs_json, root_build_dir) 1976 _rebased_native_libs_json = rebase_path(_native_libs_json, root_build_dir)
1937
1938 _native_libs_file_arg_dep = ":$_prepare_native_target_name" 1977 _native_libs_file_arg_dep = ":$_prepare_native_target_name"
1939 _native_libs_file_arg = "@FileArg($_rebased_native_libs_json:files)" 1978 _native_libs_file_arg = "@FileArg($_rebased_native_libs_json:files)"
1940 1979
1941 action(_prepare_native_target_name) { 1980 pack_relocation_section(_prepare_native_target_name) {
1942 forward_variables_from(invoker, 1981 forward_variables_from(invoker,
1943 [ 1982 [
1944 "deps", 1983 "deps",
1945 "public_deps", 1984 "public_deps",
1946 ]) 1985 ])
1947 script = "//build/android/gyp/pack_relocations.py" 1986 file_list_json = _native_libs_json
1948 depfile = "$target_gen_dir/$target_name.d" 1987 libraries_filearg =
1949 outputs = [ 1988 "@FileArg(${_rebased_build_config}:native:libraries)"
1950 _native_libs_json,
1951 ]
1952
1953 inputs = [ 1989 inputs = [
1954 _build_config, 1990 _build_config,
1955 ] 1991 ]
1956 1992
1957 deps += _native_libs_deps 1993 deps += _native_libs_deps
1958 deps += [ 1994 deps += [ ":$build_config_target" ]
1959 ":$build_config_target", 1995 }
1960 relocation_packer_target, 1996 if (_secondary_abi_native_libs_deps != []) {
1961 ] 1997 _prepare_native_target_name =
1998 "${_template_name}_secondary_abi__prepare_native"
1999 _native_libs_json =
2000 "$gen_dir/packed-libs/$android_secondary_abi_cpu/filelist.json"
2001 _rebased_native_libs_json =
2002 rebase_path(_native_libs_json, root_build_dir)
2003 _secondary_abi_native_libs_file_arg_dep =
2004 ":$_prepare_native_target_name"
2005 _secondary_abi_native_libs_file_arg =
2006 "@FileArg($_rebased_native_libs_json:files)"
1962 2007
1963 args = [ 2008 pack_relocation_section(_prepare_native_target_name) {
1964 "--depfile", 2009 forward_variables_from(invoker,
1965 rebase_path(depfile, root_build_dir), 2010 [
1966 "--enable-packing=1", 2011 "deps",
1967 "--android-pack-relocations", 2012 "public_deps",
1968 rebase_path(relocation_packer_exe, root_build_dir), 2013 ])
1969 "--stripped-libraries-dir", 2014 file_list_json = _native_libs_json
1970 rebase_path(root_build_dir, root_build_dir), 2015 libraries_filearg = "@FileArg(${_rebased_build_config}:native:secondar y_abi_libraries)"
1971 "--packed-libraries-dir", 2016 inputs = [
1972 rebase_path(_native_libs_dir, root_build_dir), 2017 _build_config,
1973 "--libraries=@FileArg(${_rebased_build_config}:native:libraries)", 2018 ]
1974 "--filelistjson=$_rebased_native_libs_json", 2019
1975 ] 2020 deps += _secondary_abi_native_libs_deps
2021 deps += [ ":$build_config_target" ]
2022 }
1976 } 2023 }
1977 } 2024 }
1978 2025
1979 _extra_native_libs = [] 2026 _extra_native_libs = []
1980 _extra_native_libs_deps = [] 2027 _extra_native_libs_deps = []
1981 _extra_native_libs_even_when_incremental = [] 2028 _extra_native_libs_even_when_incremental = []
1982 _extra_native_libs_even_when_incremental_deps = [] 2029 _extra_native_libs_even_when_incremental_deps = []
1983 assert(_extra_native_libs_even_when_incremental_deps == []) # Mark as used. 2030 assert(_extra_native_libs_even_when_incremental_deps == []) # Mark as used.
1984 if (_native_libs_deps != []) { 2031 if (_native_libs_deps != []) {
1985 # zipalign can't align gdb_server, don't pack gdbserver temporarily. 2032 # zipalign can't align gdb_server, don't pack gdbserver temporarily.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 !_create_abi_split) { 2107 !_create_abi_split) {
2061 deps += _native_libs_deps + _extra_native_libs_deps + 2108 deps += _native_libs_deps + _extra_native_libs_deps +
2062 _extra_native_libs_even_when_incremental_deps + 2109 _extra_native_libs_even_when_incremental_deps +
2063 [ _native_libs_file_arg_dep ] 2110 [ _native_libs_file_arg_dep ]
2064 native_libs_filearg = _native_libs_file_arg 2111 native_libs_filearg = _native_libs_file_arg
2065 native_libs = _extra_native_libs 2112 native_libs = _extra_native_libs
2066 native_libs_even_when_incremental = 2113 native_libs_even_when_incremental =
2067 _extra_native_libs_even_when_incremental 2114 _extra_native_libs_even_when_incremental
2068 } 2115 }
2069 2116
2117 if (_secondary_abi_native_libs_deps != [] && !_create_abi_split) {
2118 deps += _secondary_abi_native_libs_deps +
2119 [ _secondary_abi_native_libs_file_arg_dep ]
2120 secondary_abi_native_libs_filearg = _secondary_abi_native_libs_file_arg
2121 }
2122
2070 # Placeholders necessary for some older devices. 2123 # Placeholders necessary for some older devices.
2071 # http://crbug.com/395038 2124 # http://crbug.com/395038
2072 forward_variables_from(invoker, [ "native_lib_placeholders" ]) 2125 forward_variables_from(invoker, [ "native_lib_placeholders" ])
2073 } 2126 }
2074 2127
2075 if ((_native_libs_deps != [] || 2128 if ((_native_libs_deps != [] ||
2076 _extra_native_libs_even_when_incremental != []) && _create_abi_split) { 2129 _extra_native_libs_even_when_incremental != []) && _create_abi_split) {
2077 _manifest_rule = 2130 _manifest_rule =
2078 "${_template_name}__split_manifest_abi_${android_app_abi}" 2131 "${_template_name}__split_manifest_abi_${android_app_abi}"
2079 generate_split_manifest(_manifest_rule) { 2132 generate_split_manifest(_manifest_rule) {
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
2764 # because in practice they seem to contain classes required to be in the 2817 # because in practice they seem to contain classes required to be in the
2765 # classpath. 2818 # classpath.
2766 deps += _subjar_targets 2819 deps += _subjar_targets
2767 } 2820 }
2768 if (defined(_res_target_name)) { 2821 if (defined(_res_target_name)) {
2769 deps += [ ":$_res_target_name" ] 2822 deps += [ ":$_res_target_name" ]
2770 } 2823 }
2771 } 2824 }
2772 } 2825 }
2773 } 2826 }
OLDNEW
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698