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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 'natives_blob_32.bin': ['-0'], | 166 'natives_blob_32.bin': ['-0'], |
167 args.shared_library: []} | 167 args.shared_library: []} |
168 | 168 |
169 try: | 169 try: |
170 shutil.copyfile(args.apk_64bit, tmp_apk) | 170 shutil.copyfile(args.apk_64bit, tmp_apk) |
171 | 171 |
172 # need to unpack APKs to compare their contents | 172 # need to unpack APKs to compare their contents |
173 UnpackApk(args.apk_64bit, tmp_dir_64) | 173 UnpackApk(args.apk_64bit, tmp_dir_64) |
174 UnpackApk(args.apk_32bit, tmp_dir_32) | 174 UnpackApk(args.apk_32bit, tmp_dir_32) |
175 | 175 |
| 176 # TODO(sgurun) remove WebViewPlatformBridge.apk from this list crbug/580678 |
176 dcmp = filecmp.dircmp( | 177 dcmp = filecmp.dircmp( |
177 tmp_dir_64, | 178 tmp_dir_64, |
178 tmp_dir_32, | 179 tmp_dir_32, |
179 ignore=['META-INF', 'AndroidManifest.xml']) | 180 ignore=['META-INF', 'AndroidManifest.xml', 'WebViewPlatformBridge.apk']) |
180 | 181 |
181 diff_files = GetDiffFiles(dcmp, tmp_dir_32) | 182 diff_files = GetDiffFiles(dcmp, tmp_dir_32) |
182 | 183 |
183 # Check that diff_files match exactly those files we want to insert into | 184 # Check that diff_files match exactly those files we want to insert into |
184 # the 64-bit APK. | 185 # the 64-bit APK. |
185 CheckFilesExpected(diff_files, expected_files) | 186 CheckFilesExpected(diff_files, expected_files) |
186 | 187 |
187 RemoveMetafiles(tmp_apk) | 188 RemoveMetafiles(tmp_apk) |
188 | 189 |
189 AddDiffFiles(diff_files, tmp_dir_32, tmp_apk, expected_files) | 190 AddDiffFiles(diff_files, tmp_dir_32, tmp_apk, expected_files) |
190 | 191 |
191 SignAndAlignApk(tmp_apk, signed_tmp_apk, new_apk, args.zipalign_path, | 192 SignAndAlignApk(tmp_apk, signed_tmp_apk, new_apk, args.zipalign_path, |
192 args.keystore_path, args.key_name, args.key_password) | 193 args.keystore_path, args.key_name, args.key_password) |
193 | 194 |
194 except ApkMergeFailure as e: | 195 except ApkMergeFailure as e: |
195 print e | 196 print e |
196 return 1 | 197 return 1 |
197 finally: | 198 finally: |
198 shutil.rmtree(tmp_dir) | 199 shutil.rmtree(tmp_dir) |
199 return 0 | 200 return 0 |
200 | 201 |
201 | 202 |
202 if __name__ == '__main__': | 203 if __name__ == '__main__': |
203 sys.exit(main()) | 204 sys.exit(main()) |
OLD | NEW |