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 subprocess | |
11 import sys | 10 import sys |
12 | 11 |
13 from pylib import build_utils | 12 from pylib import build_utils |
14 | 13 |
15 def DoJavac(options): | 14 def DoJavac(options): |
16 output_dir = options.output_dir | 15 output_dir = options.output_dir |
17 | 16 |
18 src_dirs = build_utils.ParseGypList(options.src_dirs) | 17 src_dirs = build_utils.ParseGypList(options.src_dirs) |
19 java_files = build_utils.FindInDirectories(src_dirs, '*.java') | 18 java_files = build_utils.FindInDirectories(src_dirs, '*.java') |
20 if options.javac_includes: | 19 if options.javac_includes: |
(...skipping 13 matching lines...) Expand all Loading... |
34 | 33 |
35 classpath = build_utils.ParseGypList(options.classpath) | 34 classpath = build_utils.ParseGypList(options.classpath) |
36 | 35 |
37 # Delete the classes directory. This ensures that all .class files in the | 36 # Delete the classes directory. This ensures that all .class files in the |
38 # output are actually from the input .java files. For example, if a .java | 37 # output are actually from the input .java files. For example, if a .java |
39 # file is deleted or an inner class is removed, the classes directory should | 38 # file is deleted or an inner class is removed, the classes directory should |
40 # not contain the corresponding old .class file after running this action. | 39 # not contain the corresponding old .class file after running this action. |
41 build_utils.DeleteDirectory(output_dir) | 40 build_utils.DeleteDirectory(output_dir) |
42 build_utils.MakeDirectory(output_dir) | 41 build_utils.MakeDirectory(output_dir) |
43 | 42 |
44 subprocess.check_call([ | 43 build_utils.CheckCallDie([ |
45 'javac', | 44 'javac', |
46 '-g', | 45 '-g', |
47 '-Xlint:unchecked', | 46 '-Xlint:unchecked', |
48 '-source', '1.5', | 47 '-source', '1.5', |
49 '-target', '1.5', | 48 '-target', '1.5', |
50 '-classpath', ':'.join(classpath), | 49 '-classpath', ':'.join(classpath), |
51 '-d', output_dir] + | 50 '-d', output_dir] + |
52 java_files) | 51 java_files) |
53 | 52 |
54 | 53 |
(...skipping 15 matching lines...) Expand all Loading... |
70 DoJavac(options) | 69 DoJavac(options) |
71 | 70 |
72 if options.stamp: | 71 if options.stamp: |
73 build_utils.Touch(options.stamp) | 72 build_utils.Touch(options.stamp) |
74 | 73 |
75 | 74 |
76 if __name__ == '__main__': | 75 if __name__ == '__main__': |
77 sys.exit(main(sys.argv)) | 76 sys.exit(main(sys.argv)) |
78 | 77 |
79 | 78 |
OLD | NEW |