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

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

Issue 106923002: Don't use sys.exit() in build_utils.CheckCallDie(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
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 fnmatch 7 import fnmatch
8 import optparse 8 import optparse
9 import os 9 import os
10 import sys 10 import sys
11 11
12 from util import build_utils 12 from util import build_utils
13 13
14 def DoProguard(options): 14 def DoProguard(options):
15 injars = options.input_path 15 injars = options.input_path
16 outjars = options.output_path 16 outjars = options.output_path
17 classpath = build_utils.ParseGypList(options.classpath) 17 classpath = build_utils.ParseGypList(options.classpath)
18 classpath = list(set(classpath)) 18 classpath = list(set(classpath))
19 libraryjars = ':'.join(classpath) 19 libraryjars = ':'.join(classpath)
20 # proguard does its own dependency checking, which can be avoided by deleting 20 # proguard does its own dependency checking, which can be avoided by deleting
21 # the output. 21 # the output.
22 if os.path.exists(options.output_path): 22 if os.path.exists(options.output_path):
23 os.remove(options.output_path) 23 os.remove(options.output_path)
24 proguard_cmd = [options.proguard_path, 24 proguard_cmd = [options.proguard_path,
25 '-injars', injars, 25 '-injars', injars,
26 '-outjars', outjars, 26 '-outjars', outjars,
27 '-libraryjars', libraryjars, 27 '-libraryjars', libraryjars,
28 '@' + options.proguard_config] 28 '@' + options.proguard_config]
29 build_utils.CheckCallDie(proguard_cmd) 29 build_utils.CheckOutput(proguard_cmd, print_stdout=True)
30
30 31
31 def main(argv): 32 def main(argv):
32 parser = optparse.OptionParser() 33 parser = optparse.OptionParser()
33 parser.add_option('--proguard-path', 34 parser.add_option('--proguard-path',
34 help='Path to the proguard executable.') 35 help='Path to the proguard executable.')
35 parser.add_option('--input-path', 36 parser.add_option('--input-path',
36 help='Path to the .jar file proguard should run on.') 37 help='Path to the .jar file proguard should run on.')
37 parser.add_option('--output-path', help='Path to the generated .jar file.') 38 parser.add_option('--output-path', help='Path to the generated .jar file.')
38 parser.add_option('--proguard-config', 39 parser.add_option('--proguard-config',
39 help='Path to the proguard configuration file.') 40 help='Path to the proguard configuration file.')
40 parser.add_option('--classpath', help="Classpath for proguard.") 41 parser.add_option('--classpath', help="Classpath for proguard.")
41 parser.add_option('--stamp', help='Path to touch on success.') 42 parser.add_option('--stamp', help='Path to touch on success.')
42 43
43 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. 44 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
44 parser.add_option('--ignore', help='Ignored.') 45 parser.add_option('--ignore', help='Ignored.')
45 46
46 options, _ = parser.parse_args() 47 options, _ = parser.parse_args()
47 48
48 DoProguard(options) 49 DoProguard(options)
49 50
50 if options.stamp: 51 if options.stamp:
51 build_utils.Touch(options.stamp) 52 build_utils.Touch(options.stamp)
52 53
53 54
54 if __name__ == '__main__': 55 if __name__ == '__main__':
55 sys.exit(main(sys.argv)) 56 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698