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

Side by Side Diff: build/android/gyp/apkbuilder.py

Issue 1451483002: [Android] Add gn support for multidex. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: agrieve comments Created 5 years, 1 month 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
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 _AddAssets(apk, options.assets, disable_compression=False) 139 _AddAssets(apk, options.assets, disable_compression=False)
140 _AddAssets(apk, options.uncompressed_assets, disable_compression=True) 140 _AddAssets(apk, options.uncompressed_assets, disable_compression=True)
141 for path in native_libs: 141 for path in native_libs:
142 basename = os.path.basename(path) 142 basename = os.path.basename(path)
143 apk.write(path, 'lib/%s/%s' % (options.android_abi, basename)) 143 apk.write(path, 'lib/%s/%s' % (options.android_abi, basename))
144 if options.create_placeholder_lib: 144 if options.create_placeholder_lib:
145 # Make it non-empty so that its checksum is non-zero and is not 145 # Make it non-empty so that its checksum is non-zero and is not
146 # ignored by md5_check. 146 # ignored by md5_check.
147 apk.writestr('lib/%s/libplaceholder.so' % options.android_abi, ':-)') 147 apk.writestr('lib/%s/libplaceholder.so' % options.android_abi, ':-)')
148 if options.dex_file: 148 if options.dex_file:
149 apk.write(options.dex_file, 'classes.dex') 149 if options.dex_file.endswith('.zip'):
150 with zipfile.ZipFile(options.dex_file, 'r') as dex_zip:
151 for dex in (d for d in dex_zip.namelist() if d.endswith('.dex')):
152 apk.writestr(dex, dex_zip.read(dex))
153 else:
154 apk.write(options.dex_file, 'classes.dex')
150 155
151 shutil.move(tmp_apk, options.output_apk) 156 shutil.move(tmp_apk, options.output_apk)
152 finally: 157 finally:
153 if os.path.exists(tmp_apk): 158 if os.path.exists(tmp_apk):
154 os.unlink(tmp_apk) 159 os.unlink(tmp_apk)
155 160
156 build_utils.CallAndWriteDepfileIfStale( 161 build_utils.CallAndWriteDepfileIfStale(
157 on_stale_md5, 162 on_stale_md5,
158 options, 163 options,
159 input_paths=input_paths, 164 input_paths=input_paths,
160 input_strings=input_strings, 165 input_strings=input_strings,
161 output_paths=[options.output_apk]) 166 output_paths=[options.output_apk])
162 167
163 168
164 if __name__ == '__main__': 169 if __name__ == '__main__':
165 main(sys.argv[1:]) 170 main(sys.argv[1:])
OLDNEW
« base/BUILD.gn ('K') | « base/BUILD.gn ('k') | build/android/gyp/dex.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698