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

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

Issue 2212443002: Use more generic approach to pack java resources into final APK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use the original JAR as the source of resources. Created 4 years, 4 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/android/gyp/write_build_config.py ('k') | build/config/android/rules.gni » ('j') | 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 import("//build/config/android/config.gni") 5 import("//build/config/android/config.gni")
6 import("//build/config/sanitizers/sanitizers.gni") 6 import("//build/config/sanitizers/sanitizers.gni")
7 7
8 assert(is_android) 8 assert(is_android)
9 9
10 # These identify targets that have .build_config files (except for android_apk, 10 # These identify targets that have .build_config files (except for android_apk,
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 assert(is_deps_dex || true) 191 assert(is_deps_dex || true)
192 assert(is_group || true) 192 assert(is_group || true)
193 193
194 if (is_java || is_apk) { 194 if (is_java || is_apk) {
195 args += [ 195 args += [
196 "--jar-path", 196 "--jar-path",
197 rebase_path(invoker.jar_path, root_build_dir), 197 rebase_path(invoker.jar_path, root_build_dir),
198 ] 198 ]
199 } 199 }
200 200
201 if (is_java && defined(invoker.java_resources_jar)) {
202 args += [
203 "--java-resources-jar-path",
204 rebase_path(invoker.java_resources_jar, root_build_dir),
205 ]
206 }
201 if (is_apk || is_deps_dex || (is_java && supports_android)) { 207 if (is_apk || is_deps_dex || (is_java && supports_android)) {
202 args += [ 208 args += [
203 "--dex-path", 209 "--dex-path",
204 rebase_path(invoker.dex_path, root_build_dir), 210 rebase_path(invoker.dex_path, root_build_dir),
205 ] 211 ]
206 } 212 }
207 if (supports_android) { 213 if (supports_android) {
208 args += [ "--supports-android" ] 214 args += [ "--supports-android" ]
209 } 215 }
210 if (requires_android) { 216 if (requires_android) {
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 "--output-apk=$_rebased_packaged_apk_path", 1248 "--output-apk=$_rebased_packaged_apk_path",
1243 ] 1249 ]
1244 if (defined(invoker.assets_build_config)) { 1250 if (defined(invoker.assets_build_config)) {
1245 inputs += [ invoker.assets_build_config ] 1251 inputs += [ invoker.assets_build_config ]
1246 _rebased_build_config = 1252 _rebased_build_config =
1247 rebase_path(invoker.assets_build_config, root_build_dir) 1253 rebase_path(invoker.assets_build_config, root_build_dir)
1248 args += [ 1254 args += [
1249 "--assets=@FileArg($_rebased_build_config:assets)", 1255 "--assets=@FileArg($_rebased_build_config:assets)",
1250 "--uncompressed-assets=@FileArg($_rebased_build_config:uncompressed_as sets)", 1256 "--uncompressed-assets=@FileArg($_rebased_build_config:uncompressed_as sets)",
1251 ] 1257 ]
1258
1259 # TODO(mlopatkin) We are relying on the fact that assets_build_config is
1260 # an APK build_config.
1261 args += [ "--java-resources=@FileArg($_rebased_build_config:java_resourc es_jars)" ]
1252 } 1262 }
1253 if (defined(invoker.write_asset_list) && invoker.write_asset_list) { 1263 if (defined(invoker.write_asset_list) && invoker.write_asset_list) {
1254 args += [ "--write-asset-list" ] 1264 args += [ "--write-asset-list" ]
1255 } 1265 }
1256 if (defined(invoker.dex_path)) { 1266 if (defined(invoker.dex_path)) {
1257 _rebased_dex_path = rebase_path(invoker.dex_path, root_build_dir) 1267 _rebased_dex_path = rebase_path(invoker.dex_path, root_build_dir)
1258 args += [ "--dex-file=$_rebased_dex_path" ] 1268 args += [ "--dex-file=$_rebased_dex_path" ]
1259 } 1269 }
1260 if (invoker.native_libs != [] || defined(invoker.native_libs_filearg) || 1270 if (invoker.native_libs != [] || defined(invoker.native_libs_filearg) ||
1261 _native_lib_placeholders != []) { 1271 _native_lib_placeholders != []) {
(...skipping 13 matching lines...) Expand all
1275 invoker.secondary_native_libs != []) { 1285 invoker.secondary_native_libs != []) {
1276 assert(defined(android_app_secondary_abi)) 1286 assert(defined(android_app_secondary_abi))
1277 inputs += invoker.secondary_native_libs 1287 inputs += invoker.secondary_native_libs
1278 _secondary_native_libs = rebase_path(invoker.secondary_native_libs) 1288 _secondary_native_libs = rebase_path(invoker.secondary_native_libs)
1279 args += [ 1289 args += [
1280 "--secondary-native-libs=$_secondary_native_libs", 1290 "--secondary-native-libs=$_secondary_native_libs",
1281 "--secondary-android-abi=$android_app_secondary_abi", 1291 "--secondary-android-abi=$android_app_secondary_abi",
1282 ] 1292 ]
1283 } 1293 }
1284 1294
1285 if (defined(invoker.emma_instrument) && invoker.emma_instrument) {
1286 _emma_device_jar = "$android_sdk_root/tools/lib/emma_device.jar"
1287 _rebased_emma_device_jar = rebase_path(_emma_device_jar, root_build_dir)
1288 args += [ "--emma-device-jar=$_rebased_emma_device_jar" ]
1289 }
1290
1291 if (defined(invoker.uncompress_shared_libraries) && 1295 if (defined(invoker.uncompress_shared_libraries) &&
1292 invoker.uncompress_shared_libraries) { 1296 invoker.uncompress_shared_libraries) {
1293 args += [ "--uncompress-shared-libraries" ] 1297 args += [ "--uncompress-shared-libraries" ]
1294 } 1298 }
1295 } 1299 }
1296 } 1300 }
1297 1301
1298 # Signs & zipaligns an apk. 1302 # Signs & zipaligns an apk.
1299 # 1303 #
1300 # Variables 1304 # Variables
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 _incremental_deps + [ ":$_generate_incremental_manifest_target_name" ] 1594 _incremental_deps + [ ":$_generate_incremental_manifest_target_name" ]
1591 android_manifest = _incremental_android_manifest 1595 android_manifest = _incremental_android_manifest
1592 resource_packaged_apk_path = _incremental_resource_packaged_apk_path 1596 resource_packaged_apk_path = _incremental_resource_packaged_apk_path
1593 } 1597 }
1594 1598
1595 package_target = "${target_name}__package" 1599 package_target = "${target_name}__package"
1596 package_apk(package_target) { 1600 package_apk(package_target) {
1597 forward_variables_from(invoker, 1601 forward_variables_from(invoker,
1598 [ 1602 [
1599 "assets_build_config", 1603 "assets_build_config",
1600 "emma_instrument",
1601 "native_lib_placeholders", 1604 "native_lib_placeholders",
1602 "native_libs_filearg", 1605 "native_libs_filearg",
1603 "secondary_native_libs", 1606 "secondary_native_libs",
1604 "uncompress_shared_libraries", 1607 "uncompress_shared_libraries",
1605 "write_asset_list", 1608 "write_asset_list",
1606 ]) 1609 ])
1607 deps = _deps + [ ":${_package_resources_target_name}" ] 1610 deps = _deps + [ ":${_package_resources_target_name}" ]
1608 native_libs = _native_libs + _native_libs_even_when_incremental 1611 native_libs = _native_libs + _native_libs_even_when_incremental
1609 1612
1610 if (defined(_dex_path)) { 1613 if (defined(_dex_path)) {
1611 dex_path = _dex_path 1614 dex_path = _dex_path
1612 } 1615 }
1613 1616
1614 output_apk_path = _packaged_apk_path 1617 output_apk_path = _packaged_apk_path
1615 resource_packaged_apk_path = _resource_packaged_apk_path 1618 resource_packaged_apk_path = _resource_packaged_apk_path
1616 } 1619 }
1617 1620
1618 _incremental_package_target = "${target_name}_incremental__package" 1621 _incremental_package_target = "${target_name}_incremental__package"
1619 package_apk(_incremental_package_target) { 1622 package_apk(_incremental_package_target) {
1620 forward_variables_from(invoker, 1623 forward_variables_from(invoker,
1621 [ 1624 [
1622 "assets_build_config", 1625 "assets_build_config",
1623 "emma_instrument",
1624 "secondary_native_libs", 1626 "secondary_native_libs",
1625 "uncompress_shared_libraries", 1627 "uncompress_shared_libraries",
1626 ]) 1628 ])
1627 _dex_target = "//build/android/incremental_install:bootstrap_java__dex" 1629 _dex_target = "//build/android/incremental_install:bootstrap_java__dex"
1628 deps = _incremental_deps + [ 1630 deps = _incremental_deps + [
1629 ":${_incremental_package_resources_target_name}", 1631 ":${_incremental_package_resources_target_name}",
1630 _dex_target, 1632 _dex_target,
1631 ] 1633 ]
1632 1634
1633 if (defined(_dex_path)) { 1635 if (defined(_dex_path)) {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 defined(invoker.requires_android) && invoker.requires_android 1770 defined(invoker.requires_android) && invoker.requires_android
1769 1771
1770 if (defined(invoker.deps)) { 1772 if (defined(invoker.deps)) {
1771 possible_config_deps = _deps 1773 possible_config_deps = _deps
1772 } 1774 }
1773 build_config = _build_config 1775 build_config = _build_config
1774 jar_path = _jar_path 1776 jar_path = _jar_path
1775 if (_supports_android) { 1777 if (_supports_android) {
1776 dex_path = _dex_path 1778 dex_path = _dex_path
1777 } 1779 }
1780 if (defined(invoker.include_java_resources) &&
1781 invoker.include_java_resources) {
1782 # Use original jar_path because _jar_path points to a library without
1783 # resources.
1784 java_resources_jar = invoker.jar_path
1785 }
1778 } 1786 }
1779 1787
1780 process_java_prebuilt(_process_jar_target_name) { 1788 process_java_prebuilt(_process_jar_target_name) {
1781 forward_variables_from(invoker, 1789 forward_variables_from(invoker,
1782 [ 1790 [
1783 "jar_excluded_patterns", 1791 "jar_excluded_patterns",
1784 "strip_resource_classes", 1792 "strip_resource_classes",
1785 "input_jars_paths", 1793 "input_jars_paths",
1786 ]) 1794 ])
1787 assert(!defined(input_jars_paths) || input_jars_paths != [] || true) # Ma rk as used 1795 assert(!defined(input_jars_paths) || input_jars_paths != [] || true) # Ma rk as used
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
2630 outputs = [ 2638 outputs = [
2631 depfile, 2639 depfile,
2632 invoker.out_manifest, 2640 invoker.out_manifest,
2633 ] 2641 ]
2634 inputs = [ 2642 inputs = [
2635 invoker.main_manifest, 2643 invoker.main_manifest,
2636 ] 2644 ]
2637 } 2645 }
2638 } 2646 }
2639 } 2647 }
OLDNEW
« no previous file with comments | « build/android/gyp/write_build_config.py ('k') | build/config/android/rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698