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

Side by Side Diff: build/android/gyp/util/build_utils.py

Issue 1679623002: Create dist jars only for instrumentation apks; use ijars for them (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months 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 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import ast 5 import ast
6 import contextlib 6 import contextlib
7 import fnmatch 7 import fnmatch
8 import json 8 import json
9 import os 9 import os
10 import pipes 10 import pipes
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 return filters and any(fnmatch.fnmatch(path, f) for f in filters) 319 return filters and any(fnmatch.fnmatch(path, f) for f in filters)
320 320
321 321
322 def MergeZips(output, inputs, exclude_patterns=None, path_transform=None): 322 def MergeZips(output, inputs, exclude_patterns=None, path_transform=None):
323 path_transform = path_transform or (lambda p, z: p) 323 path_transform = path_transform or (lambda p, z: p)
324 added_names = set() 324 added_names = set()
325 325
326 with zipfile.ZipFile(output, 'w') as out_zip: 326 with zipfile.ZipFile(output, 'w') as out_zip:
327 for in_file in inputs: 327 for in_file in inputs:
328 with zipfile.ZipFile(in_file, 'r') as in_zip: 328 with zipfile.ZipFile(in_file, 'r') as in_zip:
329 for name in in_zip.namelist(): 329 in_zip._expected_crc = None
330 for info in in_zip.infolist():
330 # Ignore directories. 331 # Ignore directories.
331 if name[-1] == '/': 332 if info.filename[-1] == '/':
332 continue 333 continue
333 dst_name = path_transform(name, in_file) 334 # Don't validate CRCs. ijar sets them all to 0.
335 if hasattr(info, 'CRC'):
jbudorick 2016/02/08 16:24:12 do we only call this function for ijars...?
agrieve 2016/02/08 16:42:01 It's only needed for ijars, but I don't think veri
jbudorick 2016/02/08 16:59:10 sgtm
336 del info.CRC
337 dst_name = path_transform(info.filename, in_file)
334 already_added = dst_name in added_names 338 already_added = dst_name in added_names
335 if not already_added and not MatchesGlob(dst_name, exclude_patterns): 339 if not already_added and not MatchesGlob(dst_name, exclude_patterns):
336 AddToZipHermetic(out_zip, dst_name, data=in_zip.read(name)) 340 AddToZipHermetic(out_zip, dst_name, data=in_zip.read(info))
337 added_names.add(dst_name) 341 added_names.add(dst_name)
338 342
339 343
340 def PrintWarning(message): 344 def PrintWarning(message):
341 print 'WARNING: ' + message 345 print 'WARNING: ' + message
342 346
343 347
344 def PrintBigWarning(message): 348 def PrintBigWarning(message):
345 print '***** ' * 8 349 print '***** ' * 8
346 PrintWarning(message) 350 PrintWarning(message)
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 505
502 md5_check.CallAndRecordIfStale( 506 md5_check.CallAndRecordIfStale(
503 on_stale_md5, 507 on_stale_md5,
504 record_path=record_path, 508 record_path=record_path,
505 input_paths=input_paths, 509 input_paths=input_paths,
506 input_strings=input_strings, 510 input_strings=input_strings,
507 output_paths=output_paths, 511 output_paths=output_paths,
508 force=force, 512 force=force,
509 pass_changes=True) 513 pass_changes=True)
510 514
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698