OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """ Merges a 64-bit and a 32-bit APK into a single APK | 6 """ Merges a 64-bit and a 32-bit APK into a single APK |
7 | 7 |
8 """ | 8 """ |
9 | 9 |
10 import os | 10 import os |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 compress = False) | 185 compress = False) |
186 | 186 |
187 | 187 |
188 def MergeApk(args, tmp_apk, tmp_dir_32, tmp_dir_64): | 188 def MergeApk(args, tmp_apk, tmp_dir_32, tmp_dir_64): |
189 # Expected files to copy from 32- to 64-bit APK together with an extra flag | 189 # Expected files to copy from 32- to 64-bit APK together with an extra flag |
190 # setting the compression level of the file | 190 # setting the compression level of the file |
191 expected_files = {'snapshot_blob_32.bin': ['-0'], | 191 expected_files = {'snapshot_blob_32.bin': ['-0'], |
192 'natives_blob_32.bin': ['-0'], | 192 'natives_blob_32.bin': ['-0'], |
193 args.shared_library: []} | 193 args.shared_library: []} |
194 | 194 |
| 195 if args.debug: |
| 196 expected_files['gdbserver'] = [] |
195 if args.uncompress_shared_libraries: | 197 if args.uncompress_shared_libraries: |
196 expected_files[args.shared_library] += ['-0'] | 198 expected_files[args.shared_library] += ['-0'] |
197 | 199 |
198 shutil.copyfile(args.apk_64bit, tmp_apk) | 200 shutil.copyfile(args.apk_64bit, tmp_apk) |
199 | 201 |
200 # need to unpack APKs to compare their contents | 202 # need to unpack APKs to compare their contents |
201 UnpackApk(args.apk_64bit, tmp_dir_64) | 203 UnpackApk(args.apk_64bit, tmp_dir_64) |
202 UnpackApk(args.apk_32bit, tmp_dir_32) | 204 UnpackApk(args.apk_32bit, tmp_dir_32) |
203 | 205 |
204 dcmp = filecmp.dircmp( | 206 dcmp = filecmp.dircmp( |
(...skipping 21 matching lines...) Expand all Loading... |
226 parser.add_argument('--apk_64bit', type=os.path.abspath) | 228 parser.add_argument('--apk_64bit', type=os.path.abspath) |
227 parser.add_argument('--secondary_abi_out_dir', type=os.path.abspath) | 229 parser.add_argument('--secondary_abi_out_dir', type=os.path.abspath) |
228 parser.add_argument('--out_apk', required=True, type=os.path.abspath) | 230 parser.add_argument('--out_apk', required=True, type=os.path.abspath) |
229 parser.add_argument('--zipalign_path', required=True, type=os.path.abspath) | 231 parser.add_argument('--zipalign_path', required=True, type=os.path.abspath) |
230 parser.add_argument('--keystore_path', required=True, type=os.path.abspath) | 232 parser.add_argument('--keystore_path', required=True, type=os.path.abspath) |
231 parser.add_argument('--key_name', required=True) | 233 parser.add_argument('--key_name', required=True) |
232 parser.add_argument('--key_password', required=True) | 234 parser.add_argument('--key_password', required=True) |
233 parser.add_argument('--shared_library', required=True) | 235 parser.add_argument('--shared_library', required=True) |
234 parser.add_argument('--page-align-shared-libraries', action='store_true') | 236 parser.add_argument('--page-align-shared-libraries', action='store_true') |
235 parser.add_argument('--uncompress-shared-libraries', action='store_true') | 237 parser.add_argument('--uncompress-shared-libraries', action='store_true') |
| 238 parser.add_argument('--debug', action='store_true') |
236 args = parser.parse_args() | 239 args = parser.parse_args() |
237 | 240 |
238 tmp_dir = tempfile.mkdtemp() | 241 tmp_dir = tempfile.mkdtemp() |
239 tmp_dir_64 = os.path.join(tmp_dir, '64_bit') | 242 tmp_dir_64 = os.path.join(tmp_dir, '64_bit') |
240 tmp_dir_32 = os.path.join(tmp_dir, '32_bit') | 243 tmp_dir_32 = os.path.join(tmp_dir, '32_bit') |
241 tmp_apk = os.path.join(tmp_dir, 'tmp.apk') | 244 tmp_apk = os.path.join(tmp_dir, 'tmp.apk') |
242 signed_tmp_apk = os.path.join(tmp_dir, 'signed.apk') | 245 signed_tmp_apk = os.path.join(tmp_dir, 'signed.apk') |
243 new_apk = args.out_apk | 246 new_apk = args.out_apk |
244 | 247 |
245 try: | 248 try: |
(...skipping 16 matching lines...) Expand all Loading... |
262 except ApkMergeFailure as e: | 265 except ApkMergeFailure as e: |
263 print e | 266 print e |
264 return 1 | 267 return 1 |
265 finally: | 268 finally: |
266 shutil.rmtree(tmp_dir) | 269 shutil.rmtree(tmp_dir) |
267 return 0 | 270 return 0 |
268 | 271 |
269 | 272 |
270 if __name__ == '__main__': | 273 if __name__ == '__main__': |
271 sys.exit(main()) | 274 sys.exit(main()) |
OLD | NEW |