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

Side by Side Diff: build/android/gyp/apkbuilder.py

Issue 1619553003: Support uncompress and page align shared libraries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 11 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 | « no previous file | build/android/gyp/finalize_apk.py » ('j') | build/android/gyp/finalize_apk.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2015 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2015 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Adds the code parts to a resource APK.""" 7 """Adds the code parts to a resource APK."""
8 8
9 import argparse 9 import argparse
10 import itertools 10 import itertools
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 help='GYP-list of native libraries to include. ' 50 help='GYP-list of native libraries to include. '
51 'Can be specified multiple times.', 51 'Can be specified multiple times.',
52 default=[]) 52 default=[])
53 parser.add_argument('--android-abi', 53 parser.add_argument('--android-abi',
54 help='Android architecture to use for native libraries') 54 help='Android architecture to use for native libraries')
55 parser.add_argument('--native-lib-placeholders', 55 parser.add_argument('--native-lib-placeholders',
56 help='GYP-list of native library placeholders to add.', 56 help='GYP-list of native library placeholders to add.',
57 default='[]') 57 default='[]')
58 parser.add_argument('--emma-device-jar', 58 parser.add_argument('--emma-device-jar',
59 help='Path to emma_device.jar to include.') 59 help='Path to emma_device.jar to include.')
60 parser.add_argument('--uncompress-shared-libraries',
61 action='store_true',
62 help='Uncompress shared libraries')
60 options = parser.parse_args(args) 63 options = parser.parse_args(args)
61 options.assets = build_utils.ParseGypList(options.assets) 64 options.assets = build_utils.ParseGypList(options.assets)
62 options.uncompressed_assets = build_utils.ParseGypList( 65 options.uncompressed_assets = build_utils.ParseGypList(
63 options.uncompressed_assets) 66 options.uncompressed_assets)
64 options.native_lib_placeholders = build_utils.ParseGypList( 67 options.native_lib_placeholders = build_utils.ParseGypList(
65 options.native_lib_placeholders) 68 options.native_lib_placeholders)
66 all_libs = [] 69 all_libs = []
67 for gyp_list in options.native_libs: 70 for gyp_list in options.native_libs:
68 all_libs.extend(build_utils.ParseGypList(gyp_list)) 71 all_libs.extend(build_utils.ParseGypList(gyp_list))
69 options.native_libs = all_libs 72 options.native_libs = all_libs
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 for dex in (d for d in dex_zip.namelist() if d.endswith('.dex')): 206 for dex in (d for d in dex_zip.namelist() if d.endswith('.dex')):
204 build_utils.AddToZipHermetic(out_apk, dex, data=dex_zip.read(dex)) 207 build_utils.AddToZipHermetic(out_apk, dex, data=dex_zip.read(dex))
205 elif options.dex_file: 208 elif options.dex_file:
206 build_utils.AddToZipHermetic(out_apk, 'classes.dex', 209 build_utils.AddToZipHermetic(out_apk, 'classes.dex',
207 src_path=options.dex_file) 210 src_path=options.dex_file)
208 211
209 # 5. Native libraries. 212 # 5. Native libraries.
210 for path in native_libs: 213 for path in native_libs:
211 basename = os.path.basename(path) 214 basename = os.path.basename(path)
212 apk_path = 'lib/%s/%s' % (options.android_abi, basename) 215 apk_path = 'lib/%s/%s' % (options.android_abi, basename)
213 build_utils.AddToZipHermetic(out_apk, apk_path, src_path=path) 216
217 compress = None
218 if (options.uncompress_shared_libraries and
219 os.path.splitext(basename)[1] == '.so'):
220 compress = False
221
222 build_utils.AddToZipHermetic(out_apk,
223 apk_path,
224 src_path=path,
225 compress=compress)
214 226
215 for name in sorted(options.native_lib_placeholders): 227 for name in sorted(options.native_lib_placeholders):
216 # Empty libs files are ignored by md5check, but rezip requires them 228 # Empty libs files are ignored by md5check, but rezip requires them
217 # to be empty in order to identify them as placeholders. 229 # to be empty in order to identify them as placeholders.
218 apk_path = 'lib/%s/%s' % (options.android_abi, name) 230 apk_path = 'lib/%s/%s' % (options.android_abi, name)
219 build_utils.AddToZipHermetic(out_apk, apk_path, data='') 231 build_utils.AddToZipHermetic(out_apk, apk_path, data='')
220 232
221 # 6. Java resources. Used only when coverage is enabled, so order 233 # 6. Java resources. Used only when coverage is enabled, so order
222 # doesn't matter). 234 # doesn't matter).
223 if options.emma_device_jar: 235 if options.emma_device_jar:
(...skipping 21 matching lines...) Expand all
245 build_utils.CallAndWriteDepfileIfStale( 257 build_utils.CallAndWriteDepfileIfStale(
246 on_stale_md5, 258 on_stale_md5,
247 options, 259 options,
248 input_paths=input_paths, 260 input_paths=input_paths,
249 input_strings=input_strings, 261 input_strings=input_strings,
250 output_paths=[options.output_apk]) 262 output_paths=[options.output_apk])
251 263
252 264
253 if __name__ == '__main__': 265 if __name__ == '__main__':
254 main(sys.argv[1:]) 266 main(sys.argv[1:])
OLDNEW
« no previous file with comments | « no previous file | build/android/gyp/finalize_apk.py » ('j') | build/android/gyp/finalize_apk.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698