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

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: 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 | « android_webview/tools/apk_merger.py ('k') | build/android/gyp/finalize_apk.py » ('j') | no next file with comments »
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 for dex in (d for d in dex_zip.namelist() if d.endswith('.dex')): 202 for dex in (d for d in dex_zip.namelist() if d.endswith('.dex')):
200 build_utils.AddToZipHermetic(out_apk, dex, data=dex_zip.read(dex)) 203 build_utils.AddToZipHermetic(out_apk, dex, data=dex_zip.read(dex))
201 elif options.dex_file: 204 elif options.dex_file:
202 build_utils.AddToZipHermetic(out_apk, 'classes.dex', 205 build_utils.AddToZipHermetic(out_apk, 'classes.dex',
203 src_path=options.dex_file) 206 src_path=options.dex_file)
204 207
205 # 4. Native libraries. 208 # 4. Native libraries.
206 for path in native_libs: 209 for path in native_libs:
207 basename = os.path.basename(path) 210 basename = os.path.basename(path)
208 apk_path = 'lib/%s/%s' % (options.android_abi, basename) 211 apk_path = 'lib/%s/%s' % (options.android_abi, basename)
209 build_utils.AddToZipHermetic(out_apk, apk_path, src_path=path) 212
213 compress = None
214 if (options.uncompress_shared_libraries and
215 os.path.splitext(basename)[1] == '.so'):
216 compress = False
217
218 build_utils.AddToZipHermetic(out_apk,
219 apk_path,
220 src_path=path,
221 compress=compress)
210 222
211 for name in sorted(options.native_lib_placeholders): 223 for name in sorted(options.native_lib_placeholders):
212 # Empty libs files are ignored by md5check, but rezip requires them 224 # Empty libs files are ignored by md5check, but rezip requires them
213 # to be empty in order to identify them as placeholders. 225 # to be empty in order to identify them as placeholders.
214 apk_path = 'lib/%s/%s' % (options.android_abi, name) 226 apk_path = 'lib/%s/%s' % (options.android_abi, name)
215 build_utils.AddToZipHermetic(out_apk, apk_path, data='') 227 build_utils.AddToZipHermetic(out_apk, apk_path, data='')
216 228
217 # 5. Resources 229 # 5. Resources
218 for info in resource_infos[1:]: 230 for info in resource_infos[1:]:
219 copy_resource(info) 231 copy_resource(info)
(...skipping 25 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 | « android_webview/tools/apk_merger.py ('k') | build/android/gyp/finalize_apk.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698