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 |
11 from util import build_utils | 11 from util import build_utils |
12 from util import md5_check | |
13 from util import proguard_util | 12 from util import proguard_util |
14 | 13 |
15 | 14 |
16 def _ParseOptions(args): | 15 def _ParseOptions(args): |
17 parser = optparse.OptionParser() | 16 parser = optparse.OptionParser() |
18 build_utils.AddDepfileOption(parser) | 17 build_utils.AddDepfileOption(parser) |
19 parser.add_option('--proguard-path', | 18 parser.add_option('--proguard-path', |
20 help='Path to the proguard executable.') | 19 help='Path to the proguard executable.') |
21 parser.add_option('--input-paths', | 20 parser.add_option('--input-paths', |
22 help='Paths to the .jar files proguard should run on.') | 21 help='Paths to the .jar files proguard should run on.') |
(...skipping 30 matching lines...) Expand all Loading... |
53 if options.mapping: | 52 if options.mapping: |
54 proguard.mapping(options.mapping) | 53 proguard.mapping(options.mapping) |
55 | 54 |
56 if options.is_test: | 55 if options.is_test: |
57 proguard.is_test(True) | 56 proguard.is_test(True) |
58 | 57 |
59 classpath = list(set(options.classpath)) | 58 classpath = list(set(options.classpath)) |
60 proguard.libraryjars(classpath) | 59 proguard.libraryjars(classpath) |
61 | 60 |
62 input_paths = proguard.GetInputs() | 61 input_paths = proguard.GetInputs() |
63 python_deps = build_utils.GetPythonDependencies() | |
64 | 62 |
65 def OnStaleMd5(): | 63 build_utils.CallAndWriteDepfileIfStale( |
66 proguard.CheckOutput() | 64 proguard.CheckOutput, |
67 | 65 options, |
68 if options.depfile: | |
69 build_utils.WriteDepfile(options.depfile, python_deps + input_paths) | |
70 if options.stamp: | |
71 build_utils.Touch(options.stamp) | |
72 | |
73 md5_check.CallAndRecordIfStale( | |
74 OnStaleMd5, | |
75 record_path=options.output_path + '.proguard.md5.stamp', | |
76 input_paths=input_paths, | 66 input_paths=input_paths, |
77 input_strings=proguard.build() + python_deps, | 67 input_strings=proguard.build(), |
78 force=not os.path.exists(options.output_path)) | 68 output_paths=[options.output_path]) |
79 | 69 |
80 | 70 |
81 if __name__ == '__main__': | 71 if __name__ == '__main__': |
82 sys.exit(main(sys.argv[1:])) | 72 sys.exit(main(sys.argv[1:])) |
OLD | NEW |