OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 = not (options.uncompress_shared_libraries and | |
Yaron
2016/01/21 20:22:46
I'm not sure this is exactly right. This is forcin
michaelbai
2016/01/21 21:58:03
Thanks, I should keep previous behavior.
| |
218 os.path.splitext(basename)[1] == '.so') | |
219 | |
220 build_utils.AddToZipHermetic(out_apk, | |
221 apk_path, | |
222 src_path=path, | |
223 compress=compress) | |
214 | 224 |
215 for name in sorted(options.native_lib_placeholders): | 225 for name in sorted(options.native_lib_placeholders): |
216 # Empty libs files are ignored by md5check, but rezip requires them | 226 # Empty libs files are ignored by md5check, but rezip requires them |
217 # to be empty in order to identify them as placeholders. | 227 # to be empty in order to identify them as placeholders. |
218 apk_path = 'lib/%s/%s' % (options.android_abi, name) | 228 apk_path = 'lib/%s/%s' % (options.android_abi, name) |
219 build_utils.AddToZipHermetic(out_apk, apk_path, data='') | 229 build_utils.AddToZipHermetic(out_apk, apk_path, data='') |
220 | 230 |
221 # 6. Java resources. Used only when coverage is enabled, so order | 231 # 6. Java resources. Used only when coverage is enabled, so order |
222 # doesn't matter). | 232 # doesn't matter). |
223 if options.emma_device_jar: | 233 if options.emma_device_jar: |
(...skipping 21 matching lines...) Expand all Loading... | |
245 build_utils.CallAndWriteDepfileIfStale( | 255 build_utils.CallAndWriteDepfileIfStale( |
246 on_stale_md5, | 256 on_stale_md5, |
247 options, | 257 options, |
248 input_paths=input_paths, | 258 input_paths=input_paths, |
249 input_strings=input_strings, | 259 input_strings=input_strings, |
250 output_paths=[options.output_apk]) | 260 output_paths=[options.output_apk]) |
251 | 261 |
252 | 262 |
253 if __name__ == '__main__': | 263 if __name__ == '__main__': |
254 main(sys.argv[1:]) | 264 main(sys.argv[1:]) |
OLD | NEW |