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 fnmatch | 7 import fnmatch |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import shutil | 10 import shutil |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 Compile, | 104 Compile, |
105 record_path=record_path, | 105 record_path=record_path, |
106 input_paths=java_files + jar_inputs, | 106 input_paths=java_files + jar_inputs, |
107 input_strings=javac_cmd) | 107 input_strings=javac_cmd) |
108 | 108 |
109 | 109 |
110 def main(): | 110 def main(): |
111 colorama.init() | 111 colorama.init() |
112 | 112 |
113 parser = optparse.OptionParser() | 113 parser = optparse.OptionParser() |
| 114 build_utils.AddDepfileOption(parser) |
| 115 |
114 parser.add_option( | 116 parser.add_option( |
115 '--src-gendirs', | 117 '--src-gendirs', |
116 help='Directories containing generated java files.') | 118 help='Directories containing generated java files.') |
117 parser.add_option('--classpath', help='Classpath for javac.') | 119 parser.add_option('--classpath', help='Classpath for javac.') |
118 parser.add_option( | 120 parser.add_option( |
119 '--javac-includes', | 121 '--javac-includes', |
120 help='A list of file patterns. If provided, only java files that match' + | 122 help='A list of file patterns. If provided, only java files that match' + |
121 'one of the patterns will be compiled.') | 123 'one of the patterns will be compiled.') |
122 parser.add_option( | 124 parser.add_option( |
123 '--jar-excluded-classes', | 125 '--jar-excluded-classes', |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 160 |
159 if options.classes_dir: | 161 if options.classes_dir: |
160 # Delete the old classes directory. This ensures that all .class files in | 162 # Delete the old classes directory. This ensures that all .class files in |
161 # the output are actually from the input .java files. For example, if a | 163 # the output are actually from the input .java files. For example, if a |
162 # .java file is deleted or an inner class is removed, the classes | 164 # .java file is deleted or an inner class is removed, the classes |
163 # directory should not contain the corresponding old .class file after | 165 # directory should not contain the corresponding old .class file after |
164 # running this action. | 166 # running this action. |
165 build_utils.DeleteDirectory(options.classes_dir) | 167 build_utils.DeleteDirectory(options.classes_dir) |
166 shutil.copytree(classes_dir, options.classes_dir) | 168 shutil.copytree(classes_dir, options.classes_dir) |
167 | 169 |
| 170 if options.depfile: |
| 171 build_utils.WriteDepfile( |
| 172 options.depfile, |
| 173 build_utils.GetPythonDependencies()) |
| 174 |
168 if options.stamp: | 175 if options.stamp: |
169 build_utils.Touch(options.stamp) | 176 build_utils.Touch(options.stamp) |
170 | 177 |
171 | 178 |
172 if __name__ == '__main__': | 179 if __name__ == '__main__': |
173 sys.exit(main()) | 180 sys.exit(main()) |
174 | 181 |
175 | 182 |
OLD | NEW |