| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 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 optparse | 7 import optparse |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 # proguard does its own dependency checking, which can be avoided by deleting | 21 # proguard does its own dependency checking, which can be avoided by deleting |
| 22 # the output. | 22 # the output. |
| 23 if os.path.exists(options.output_path): | 23 if os.path.exists(options.output_path): |
| 24 os.remove(options.output_path) | 24 os.remove(options.output_path) |
| 25 proguard_cmd = ['java', '-jar', | 25 proguard_cmd = ['java', '-jar', |
| 26 options.proguard_path, | 26 options.proguard_path, |
| 27 '-injars', injars, | 27 '-injars', injars, |
| 28 '-outjars', outjars, | 28 '-outjars', outjars, |
| 29 '-libraryjars', libraryjars, | 29 '-libraryjars', libraryjars, |
| 30 '@' + options.proguard_config] | 30 '@' + options.proguard_config] |
| 31 build_utils.CheckOutput(proguard_cmd, print_stdout=True) | 31 build_utils.CheckOutput(proguard_cmd, print_stdout=True, |
| 32 stdout_filter=FilterProguardOutput) |
| 33 |
| 34 |
| 35 def FilterProguardOutput(output): |
| 36 '''ProGuard outputs boring stuff to stdout (proguard version, jar path, etc) |
| 37 as well as interesting stuff (notes, warnings, etc). If stdout is entirely |
| 38 boring, this method suppresses the output. |
| 39 ''' |
| 40 ignore_patterns = [ |
| 41 'ProGuard, version ', |
| 42 'Reading program jar [', |
| 43 'Reading library jar [', |
| 44 'Preparing output jar [', |
| 45 ' Copying resources from program jar [', |
| 46 ] |
| 47 for line in output.splitlines(): |
| 48 for pattern in ignore_patterns: |
| 49 if line.startswith(pattern): |
| 50 break |
| 51 else: |
| 52 # line doesn't match any of the patterns; it's probably something worth |
| 53 # printing out. |
| 54 return output |
| 55 return '' |
| 32 | 56 |
| 33 | 57 |
| 34 def main(args): | 58 def main(args): |
| 35 args = build_utils.ExpandFileArgs(args) | 59 args = build_utils.ExpandFileArgs(args) |
| 36 parser = optparse.OptionParser() | 60 parser = optparse.OptionParser() |
| 37 build_utils.AddDepfileOption(parser) | 61 build_utils.AddDepfileOption(parser) |
| 38 parser.add_option('--proguard-path', | 62 parser.add_option('--proguard-path', |
| 39 help='Path to the proguard executable.') | 63 help='Path to the proguard executable.') |
| 40 parser.add_option('--input-path', | 64 parser.add_option('--input-path', |
| 41 help='Path to the .jar file proguard should run on.') | 65 help='Path to the .jar file proguard should run on.') |
| (...skipping 12 matching lines...) Expand all Loading... |
| 54 build_utils.WriteDepfile( | 78 build_utils.WriteDepfile( |
| 55 options.depfile, | 79 options.depfile, |
| 56 build_utils.GetPythonDependencies()) | 80 build_utils.GetPythonDependencies()) |
| 57 | 81 |
| 58 if options.stamp: | 82 if options.stamp: |
| 59 build_utils.Touch(options.stamp) | 83 build_utils.Touch(options.stamp) |
| 60 | 84 |
| 61 | 85 |
| 62 if __name__ == '__main__': | 86 if __name__ == '__main__': |
| 63 sys.exit(main(sys.argv[1:])) | 87 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |