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 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 # "transitive closure" of these dependencies will be included in the apk. | 1184 # "transitive closure" of these dependencies will be included in the apk. |
1185 # Note: this "transitive closure" actually only includes such targets if | 1185 # Note: this "transitive closure" actually only includes such targets if |
1186 # they are depended on through android_library or android_resources targets | 1186 # they are depended on through android_library or android_resources targets |
1187 # (and so not through builtin targets like 'action', 'group', etc). | 1187 # (and so not through builtin targets like 'action', 'group', etc). |
1188 # java_files: List of .java files to include in the apk. | 1188 # java_files: List of .java files to include in the apk. |
1189 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars | 1189 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars |
1190 # will be added to java_files and be included in this apk. | 1190 # will be added to java_files and be included in this apk. |
1191 # apk_name: Name for final apk. | 1191 # apk_name: Name for final apk. |
1192 # final_apk_path: Path to final built apk. Default is | 1192 # final_apk_path: Path to final built apk. Default is |
1193 # $root_out_dir/apks/$apk_name.apk. Setting this will override apk_name. | 1193 # $root_out_dir/apks/$apk_name.apk. Setting this will override apk_name. |
| 1194 # loadable_modules: List of paths to native libraries to include. Different |
| 1195 # from |native_libs| in that: |
| 1196 # * dependencies of this .so are not automatically included, |
| 1197 # * ".cr.so" is never added |
| 1198 # * load_library_from_apk and enable_relocation_packing do not apply |
| 1199 # * not side-loaded for _incremental targets. |
| 1200 # Use this instead of native_libs when you are going to load the library |
| 1201 # conditionally, and only when native_libs doesn't work for you. |
1194 # native_libs: List paths of native libraries to include in this apk. If these | 1202 # native_libs: List paths of native libraries to include in this apk. If these |
1195 # libraries depend on other shared_library targets, those dependencies will | 1203 # libraries depend on other shared_library targets, those dependencies will |
1196 # also be included in the apk. | 1204 # also be included in the apk. When building with is_component_build, |
| 1205 # The extension is automatically changed to ".cr.so". |
1197 # native_lib_placeholders: List of placeholder filenames to add to the apk | 1206 # native_lib_placeholders: List of placeholder filenames to add to the apk |
1198 # (optional). | 1207 # (optional). |
1199 # apk_under_test: For an instrumentation test apk, this is the target of the | 1208 # apk_under_test: For an instrumentation test apk, this is the target of the |
1200 # tested apk. | 1209 # tested apk. |
1201 # include_all_resources - If true include all resource IDs in all generated | 1210 # include_all_resources - If true include all resource IDs in all generated |
1202 # R.java files. | 1211 # R.java files. |
1203 # testonly: Marks this target as "test-only". | 1212 # testonly: Marks this target as "test-only". |
1204 # write_asset_list: Adds an extra file to the assets, which contains a list of | 1213 # write_asset_list: Adds an extra file to the assets, which contains a list of |
1205 # all other asset files. | 1214 # all other asset files. |
1206 # | 1215 # |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 [ _final_apk_path ], | 1270 [ _final_apk_path ], |
1262 "$root_build_dir/test.lib.java/{{source_name_part}}.jar") | 1271 "$root_build_dir/test.lib.java/{{source_name_part}}.jar") |
1263 _dist_jar_path = _dist_jar_path_list[0] | 1272 _dist_jar_path = _dist_jar_path_list[0] |
1264 _final_apk_path_no_ext_list = | 1273 _final_apk_path_no_ext_list = |
1265 process_file_template([ _final_apk_path ], | 1274 process_file_template([ _final_apk_path ], |
1266 "{{source_dir}}/{{source_name_part}}") | 1275 "{{source_dir}}/{{source_name_part}}") |
1267 _final_apk_path_no_ext = _final_apk_path_no_ext_list[0] | 1276 _final_apk_path_no_ext = _final_apk_path_no_ext_list[0] |
1268 assert(_final_apk_path_no_ext != "") # Mark as used. | 1277 assert(_final_apk_path_no_ext != "") # Mark as used. |
1269 | 1278 |
1270 _native_libs = [] | 1279 _native_libs = [] |
| 1280 _loadable_modules = [] |
| 1281 if (defined(invoker.loadable_modules)) { |
| 1282 _loadable_modules = invoker.loadable_modules |
| 1283 } |
1271 | 1284 |
1272 _version_code = "1" | 1285 _version_code = "1" |
1273 if (defined(invoker.version_code)) { | 1286 if (defined(invoker.version_code)) { |
1274 _version_code = invoker.version_code | 1287 _version_code = invoker.version_code |
1275 } | 1288 } |
1276 | 1289 |
1277 _version_name = "Developer Build" | 1290 _version_name = "Developer Build" |
1278 if (defined(invoker.version_name)) { | 1291 if (defined(invoker.version_name)) { |
1279 _version_name = invoker.version_name | 1292 _version_name = invoker.version_name |
1280 } | 1293 } |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1688 ":$process_resources_target", | 1701 ":$process_resources_target", |
1689 ] | 1702 ] |
1690 | 1703 |
1691 # This target generates the input file _all_resources_zip_path. | 1704 # This target generates the input file _all_resources_zip_path. |
1692 deps += _android_manifest_deps + [ | 1705 deps += _android_manifest_deps + [ |
1693 ":$build_config_target", | 1706 ":$build_config_target", |
1694 ":$process_resources_target", | 1707 ":$process_resources_target", |
1695 ":$final_dex_target_name", | 1708 ":$final_dex_target_name", |
1696 ] | 1709 ] |
1697 | 1710 |
1698 if (_native_libs != [] && !_create_abi_split) { | 1711 if ((_native_libs != [] || _loadable_modules != []) && !_create_abi_split) { |
1699 native_libs_dir = _native_libs_dir | 1712 native_libs_dir = _native_libs_dir |
| 1713 native_libs = _loadable_modules |
1700 | 1714 |
1701 # Placeholders necessary for some older devices. | 1715 # Placeholders necessary for some older devices. |
1702 # http://crbug.com/395038 | 1716 # http://crbug.com/395038 |
1703 forward_variables_from(invoker, [ "native_lib_placeholders" ]) | 1717 forward_variables_from(invoker, [ "native_lib_placeholders" ]) |
1704 | 1718 |
1705 deps += [ ":$_prepare_native_target_name" ] | 1719 deps += [ ":$_prepare_native_target_name" ] |
1706 } | 1720 } |
1707 } | 1721 } |
1708 | 1722 |
1709 if (_native_libs != [] && _create_abi_split) { | 1723 if ((_native_libs != [] || _loadable_modules != []) && _create_abi_split) { |
1710 _manifest_rule = "${_template_name}__split_manifest_abi_${android_app_abi}" | 1724 _manifest_rule = "${_template_name}__split_manifest_abi_${android_app_abi}" |
1711 generate_split_manifest(_manifest_rule) { | 1725 generate_split_manifest(_manifest_rule) { |
1712 main_manifest = _android_manifest | 1726 main_manifest = _android_manifest |
1713 out_manifest = | 1727 out_manifest = |
1714 "$gen_dir/split-manifests/${android_app_abi}/AndroidManifest.xml" | 1728 "$gen_dir/split-manifests/${android_app_abi}/AndroidManifest.xml" |
1715 split_name = "abi_${android_app_abi}" | 1729 split_name = "abi_${android_app_abi}" |
1716 deps = _android_manifest_deps | 1730 deps = _android_manifest_deps |
1717 } | 1731 } |
1718 | 1732 |
1719 _apk_rule = "${_template_name}__split_apk_abi_${android_app_abi}" | 1733 _apk_rule = "${_template_name}__split_apk_abi_${android_app_abi}" |
1720 _final_deps += [ ":$_apk_rule" ] | 1734 _final_deps += [ ":$_apk_rule" ] |
1721 | 1735 |
1722 create_apk(_apk_rule) { | 1736 create_apk(_apk_rule) { |
1723 apk_path = "${_final_apk_path_no_ext}-abi-${android_app_abi}.apk" | 1737 apk_path = "${_final_apk_path_no_ext}-abi-${android_app_abi}.apk" |
1724 base_path = "$gen_dir/$_apk_rule" | 1738 base_path = "$gen_dir/$_apk_rule" |
1725 | 1739 |
1726 manifest_outputs = get_target_outputs(":${_manifest_rule}") | 1740 manifest_outputs = get_target_outputs(":${_manifest_rule}") |
1727 android_manifest = manifest_outputs[1] | 1741 android_manifest = manifest_outputs[1] |
1728 load_library_from_apk = _load_library_from_apk | 1742 load_library_from_apk = _load_library_from_apk |
1729 | 1743 |
1730 version_code = _version_code | 1744 version_code = _version_code |
1731 version_name = _version_name | 1745 version_name = _version_name |
1732 | 1746 |
1733 keystore_name = _keystore_name | 1747 keystore_name = _keystore_name |
1734 keystore_path = _keystore_path | 1748 keystore_path = _keystore_path |
1735 keystore_password = _keystore_password | 1749 keystore_password = _keystore_password |
1736 | 1750 |
1737 native_libs_dir = _native_libs_dir | 1751 native_libs_dir = _native_libs_dir |
| 1752 native_libs = _loadable_modules |
1738 | 1753 |
1739 # Placeholders necessary for some older devices. | 1754 # Placeholders necessary for some older devices. |
1740 # http://crbug.com/395038 | 1755 # http://crbug.com/395038 |
1741 forward_variables_from(invoker, [ "native_lib_placeholders" ]) | 1756 forward_variables_from(invoker, [ "native_lib_placeholders" ]) |
1742 | 1757 |
1743 deps = [ | 1758 deps = [ |
1744 ":${_manifest_rule}", | 1759 ":${_manifest_rule}", |
1745 ":${_prepare_native_target_name}", | 1760 ":${_prepare_native_target_name}", |
1746 ] | 1761 ] |
1747 incremental_deps = deps | 1762 incremental_deps = deps |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2195 } | 2210 } |
2196 | 2211 |
2197 android_library(target_name) { | 2212 android_library(target_name) { |
2198 java_files = [] | 2213 java_files = [] |
2199 srcjar_deps = [ ":${_template_name}__protoc_java" ] | 2214 srcjar_deps = [ ":${_template_name}__protoc_java" ] |
2200 deps = [ | 2215 deps = [ |
2201 "//third_party/android_protobuf:protobuf_nano_javalib", | 2216 "//third_party/android_protobuf:protobuf_nano_javalib", |
2202 ] | 2217 ] |
2203 } | 2218 } |
2204 } | 2219 } |
OLD | NEW |