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 sys | 10 import sys |
(...skipping 29 matching lines...) Expand all Loading... | |
40 # not contain the corresponding old .class file after running this action. | 40 # not contain the corresponding old .class file after running this action. |
41 build_utils.DeleteDirectory(output_dir) | 41 build_utils.DeleteDirectory(output_dir) |
42 build_utils.MakeDirectory(output_dir) | 42 build_utils.MakeDirectory(output_dir) |
43 | 43 |
44 cmd = [ | 44 cmd = [ |
45 'javac', | 45 'javac', |
46 '-g', | 46 '-g', |
47 '-source', '1.5', | 47 '-source', '1.5', |
48 '-target', '1.5', | 48 '-target', '1.5', |
49 '-classpath', ':'.join(classpath), | 49 '-classpath', ':'.join(classpath), |
50 '-d', output_dir] | 50 '-d', output_dir, |
51 '-Xlint:unchecked', | |
52 '-Xlint:deprecation', | |
53 ] | |
51 | 54 |
52 # Only output Java warnings for chromium code | 55 suppress_output = not options.chromium_code |
53 if options.chromium_code: | 56 build_utils.CheckCallDie(cmd + java_files, suppress_output=suppress_output) |
newt (away)
2013/04/04 02:00:47
suppress_output causes us to print the output iff
cjhopman
2013/04/05 00:11:29
correct.
| |
54 cmd += ['-Xlint:unchecked'] | |
55 else: | |
56 cmd += [# Suppress "Sun proprietary API" warnings. See: goo.gl/OYxUM | |
57 '-XDignore.symbol.file'] | |
58 | |
59 build_utils.CheckCallDie(cmd + java_files) | |
60 | 57 |
61 def main(argv): | 58 def main(argv): |
62 parser = optparse.OptionParser() | 59 parser = optparse.OptionParser() |
63 parser.add_option('--src-dirs', help='Directories containing java files.') | 60 parser.add_option('--src-dirs', help='Directories containing java files.') |
64 parser.add_option('--javac-includes', | 61 parser.add_option('--javac-includes', |
65 help='A list of file patterns. If provided, only java files that match' + | 62 help='A list of file patterns. If provided, only java files that match' + |
66 'one of the patterns will be compiled.') | 63 'one of the patterns will be compiled.') |
67 parser.add_option('--classpath', help='Classpath for javac.') | 64 parser.add_option('--classpath', help='Classpath for javac.') |
68 parser.add_option('--output-dir', help='Directory for javac output.') | 65 parser.add_option('--output-dir', help='Directory for javac output.') |
69 parser.add_option('--stamp', help='Path to touch on success.') | 66 parser.add_option('--stamp', help='Path to touch on success.') |
70 parser.add_option('--chromium-code', type='int', help='Whether code being ' | 67 parser.add_option('--chromium-code', type='int', help='Whether code being ' |
71 'compiled should be built with stricter warnings for ' | 68 'compiled should be built with stricter warnings for ' |
72 'chromium code.') | 69 'chromium code.') |
73 | 70 |
74 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. | 71 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. |
75 parser.add_option('--ignore', help='Ignored.') | 72 parser.add_option('--ignore', help='Ignored.') |
76 | 73 |
77 options, _ = parser.parse_args() | 74 options, _ = parser.parse_args() |
78 | 75 |
79 DoJavac(options) | 76 DoJavac(options) |
80 | 77 |
81 if options.stamp: | 78 if options.stamp: |
82 build_utils.Touch(options.stamp) | 79 build_utils.Touch(options.stamp) |
83 | 80 |
84 | 81 |
85 if __name__ == '__main__': | 82 if __name__ == '__main__': |
86 sys.exit(main(sys.argv)) | 83 sys.exit(main(sys.argv)) |
87 | 84 |
88 | 85 |
OLD | NEW |