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

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

Issue 2595233003: Revert of Android: Delete rezip in favor of zipalign -p (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « android_webview/tools/apk_merger.py ('k') | build/android/gyp/finalize_apk.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 def _CreateAssetsList(path_tuples): 156 def _CreateAssetsList(path_tuples):
157 """Returns a newline-separated list of asset paths for the given paths.""" 157 """Returns a newline-separated list of asset paths for the given paths."""
158 dests = sorted(t[1] for t in path_tuples) 158 dests = sorted(t[1] for t in path_tuples)
159 return '\n'.join(dests) + '\n' 159 return '\n'.join(dests) + '\n'
160 160
161 161
162 def _AddNativeLibraries(out_apk, native_libs, android_abi, uncompress): 162 def _AddNativeLibraries(out_apk, native_libs, android_abi, uncompress):
163 """Add native libraries to APK.""" 163 """Add native libraries to APK."""
164 for path in native_libs: 164 for path in native_libs:
165 basename = os.path.basename(path) 165 basename = os.path.basename(path)
166 apk_path = 'lib/%s/%s' % (android_abi, basename)
166 167
167 compress = None 168 compress = None
168 if (uncompress and os.path.splitext(basename)[1] == '.so' 169 if (uncompress and os.path.splitext(basename)[1] == '.so'):
169 and 'android_linker' not in basename):
170 compress = False 170 compress = False
171 # Add prefix to prevent android install from extracting upon install.
172 basename = 'crazy.' + basename
173 171
174 apk_path = 'lib/%s/%s' % (android_abi, basename)
175 build_utils.AddToZipHermetic(out_apk, 172 build_utils.AddToZipHermetic(out_apk,
176 apk_path, 173 apk_path,
177 src_path=path, 174 src_path=path,
178 compress=compress) 175 compress=compress)
179 176
180 177
181 def main(args): 178 def main(args):
182 args = build_utils.ExpandFileArgs(args) 179 args = build_utils.ExpandFileArgs(args)
183 options = _ParseArgs(args) 180 options = _ParseArgs(args)
184 181
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 options.android_abi, 258 options.android_abi,
262 options.uncompress_shared_libraries) 259 options.uncompress_shared_libraries)
263 260
264 if options.secondary_android_abi: 261 if options.secondary_android_abi:
265 _AddNativeLibraries(out_apk, 262 _AddNativeLibraries(out_apk,
266 secondary_native_libs, 263 secondary_native_libs,
267 options.secondary_android_abi, 264 options.secondary_android_abi,
268 options.uncompress_shared_libraries) 265 options.uncompress_shared_libraries)
269 266
270 for name in sorted(options.native_lib_placeholders): 267 for name in sorted(options.native_lib_placeholders):
271 # Note: Empty libs files are ignored by md5check (can cause issues 268 # Empty libs files are ignored by md5check, but rezip requires them
272 # with stale builds when the only change is adding/removing 269 # to be empty in order to identify them as placeholders.
273 # placeholders).
274 apk_path = 'lib/%s/%s' % (options.android_abi, name) 270 apk_path = 'lib/%s/%s' % (options.android_abi, name)
275 build_utils.AddToZipHermetic(out_apk, apk_path, data='') 271 build_utils.AddToZipHermetic(out_apk, apk_path, data='')
276 272
277 # 5. Resources 273 # 5. Resources
278 for info in resource_infos[1:]: 274 for info in resource_infos[1:]:
279 copy_resource(info) 275 copy_resource(info)
280 276
281 # 6. Java resources. Used only when coverage is enabled, so order 277 # 6. Java resources. Used only when coverage is enabled, so order
282 # doesn't matter). 278 # doesn't matter).
283 if options.emma_device_jar: 279 if options.emma_device_jar:
(...skipping 22 matching lines...) Expand all
306 on_stale_md5, 302 on_stale_md5,
307 options, 303 options,
308 input_paths=input_paths, 304 input_paths=input_paths,
309 input_strings=input_strings, 305 input_strings=input_strings,
310 output_paths=[options.output_apk], 306 output_paths=[options.output_apk],
311 depfile_deps=depfile_deps) 307 depfile_deps=depfile_deps)
312 308
313 309
314 if __name__ == '__main__': 310 if __name__ == '__main__':
315 main(sys.argv[1:]) 311 main(sys.argv[1:])
OLDNEW
« no previous file with comments | « android_webview/tools/apk_merger.py ('k') | build/android/gyp/finalize_apk.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698