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

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

Issue 1452843002: Use hermetic timestamps in apkbuilder.py and refactor helper function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review 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 2014 The Chromium Authors. All rights reserved. 3 # Copyright 2014 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 import collections 7 import collections
8 from datetime import date 8 from datetime import date
9 import re 9 import re
10 import optparse 10 import optparse
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 321
322 options, args = parser.parse_args(argv) 322 options, args = parser.parse_args(argv)
323 if options.srcjar: 323 if options.srcjar:
324 if options.print_output_only: 324 if options.print_output_only:
325 parser.error('--print_output_only does not work with --srcjar') 325 parser.error('--print_output_only does not work with --srcjar')
326 if options.assert_files_list: 326 if options.assert_files_list:
327 parser.error('--assert_file does not work with --srcjar') 327 parser.error('--assert_file does not work with --srcjar')
328 328
329 with zipfile.ZipFile(options.srcjar, 'w', zipfile.ZIP_STORED) as srcjar: 329 with zipfile.ZipFile(options.srcjar, 'w', zipfile.ZIP_STORED) as srcjar:
330 for output_path, data in DoGenerate(args): 330 for output_path, data in DoGenerate(args):
331 srcjar.writestr(build_utils.CreateHermeticZipInfo(output_path), data) 331 build_utils.AddToZipHermetic(srcjar, output_path, data=data)
332 else: 332 else:
333 # TODO(agrieve): Delete this non-srcjar branch once GYP is gone. 333 # TODO(agrieve): Delete this non-srcjar branch once GYP is gone.
334 if len(args) < 2: 334 if len(args) < 2:
335 parser.error( 335 parser.error(
336 'Need to specify output directory and at least one input file') 336 'Need to specify output directory and at least one input file')
337 337
338 output_dir = args[0] 338 output_dir = args[0]
339 output_paths = [] 339 output_paths = []
340 for output_path, data in DoGenerate(args[1:]): 340 for output_path, data in DoGenerate(args[1:]):
341 full_path = os.path.join(output_dir, output_path) 341 full_path = os.path.join(output_dir, output_path)
342 output_paths.append(full_path) 342 output_paths.append(full_path)
343 if not options.print_output_only: 343 if not options.print_output_only:
344 build_utils.MakeDirectory(os.path.dirname(full_path)) 344 build_utils.MakeDirectory(os.path.dirname(full_path))
345 with open(full_path, 'w') as out_file: 345 with open(full_path, 'w') as out_file:
346 out_file.write(data) 346 out_file.write(data)
347 347
348 if options.assert_files_list: 348 if options.assert_files_list:
349 AssertFilesList(output_paths, options.assert_files_list) 349 AssertFilesList(output_paths, options.assert_files_list)
350 350
351 if options.verbose: 351 if options.verbose:
352 print 'Output paths:' 352 print 'Output paths:'
353 print '\n'.join(output_paths) 353 print '\n'.join(output_paths)
354 354
355 # Used by GYP. 355 # Used by GYP.
356 return ' '.join(output_paths) 356 return ' '.join(output_paths)
357 357
358 358
359 if __name__ == '__main__': 359 if __name__ == '__main__':
360 DoMain(sys.argv[1:]) 360 DoMain(sys.argv[1:])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698