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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 build_utils.AddToZipHermetic(out_apk, 'classes.dex', | 206 build_utils.AddToZipHermetic(out_apk, 'classes.dex', |
207 src_path=options.dex_file) | 207 src_path=options.dex_file) |
208 | 208 |
209 # 5. Native libraries. | 209 # 5. Native libraries. |
210 for path in native_libs: | 210 for path in native_libs: |
211 basename = os.path.basename(path) | 211 basename = os.path.basename(path) |
212 apk_path = 'lib/%s/%s' % (options.android_abi, basename) | 212 apk_path = 'lib/%s/%s' % (options.android_abi, basename) |
213 build_utils.AddToZipHermetic(out_apk, apk_path, src_path=path) | 213 build_utils.AddToZipHermetic(out_apk, apk_path, src_path=path) |
214 | 214 |
215 for name in sorted(options.native_lib_placeholders): | 215 for name in sorted(options.native_lib_placeholders): |
216 # Make it non-empty so that its checksum is non-zero and is not | 216 # Empty libs files are ignored by md5check, but rezip requires them |
217 # ignored by md5_check. | 217 # to be empty in order to identify them as placeholders. |
218 apk_path = 'lib/%s/%s.so' % (options.android_abi, name) | 218 apk_path = 'lib/%s/%s' % (options.android_abi, name) |
219 build_utils.AddToZipHermetic(out_apk, apk_path, data=':)') | 219 build_utils.AddToZipHermetic(out_apk, apk_path, data='') |
220 | 220 |
221 # 6. Java resources. Used only when coverage is enabled, so order | 221 # 6. Java resources. Used only when coverage is enabled, so order |
222 # doesn't matter). | 222 # doesn't matter). |
223 if options.emma_device_jar: | 223 if options.emma_device_jar: |
224 # Add EMMA Java resources to APK. | 224 # Add EMMA Java resources to APK. |
225 with zipfile.ZipFile(options.emma_device_jar, 'r') as emma_device_jar: | 225 with zipfile.ZipFile(options.emma_device_jar, 'r') as emma_device_jar: |
226 for apk_path in emma_device_jar.namelist(): | 226 for apk_path in emma_device_jar.namelist(): |
227 apk_path_lower = apk_path.lower() | 227 apk_path_lower = apk_path.lower() |
228 if apk_path_lower.startswith('meta-inf/'): | 228 if apk_path_lower.startswith('meta-inf/'): |
229 continue | 229 continue |
(...skipping 15 matching lines...) Expand all Loading... |
245 build_utils.CallAndWriteDepfileIfStale( | 245 build_utils.CallAndWriteDepfileIfStale( |
246 on_stale_md5, | 246 on_stale_md5, |
247 options, | 247 options, |
248 input_paths=input_paths, | 248 input_paths=input_paths, |
249 input_strings=input_strings, | 249 input_strings=input_strings, |
250 output_paths=[options.output_apk]) | 250 output_paths=[options.output_apk]) |
251 | 251 |
252 | 252 |
253 if __name__ == '__main__': | 253 if __name__ == '__main__': |
254 main(sys.argv[1:]) | 254 main(sys.argv[1:]) |
OLD | NEW |