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 |
11 | 11 |
| 12 # pylint: disable=F0401 |
12 from util import build_utils | 13 from util import build_utils |
13 from util import md5_check | 14 from util import md5_check |
| 15 # pylint: enable=F0401 |
14 | 16 |
15 | 17 |
16 def DoJavac(options): | 18 def DoJavac(options): |
17 output_dir = options.output_dir | 19 output_dir = options.output_dir |
18 | 20 |
19 src_dirs = build_utils.ParseGypList(options.src_dirs) | 21 src_dirs = build_utils.ParseGypList(options.src_dirs) |
20 java_files = build_utils.FindInDirectories(src_dirs, '*.java') | 22 java_files = build_utils.FindInDirectories(src_dirs, '*.java') |
21 if options.javac_includes: | 23 if options.javac_includes: |
22 javac_includes = build_utils.ParseGypList(options.javac_includes) | 24 javac_includes = build_utils.ParseGypList(options.javac_includes) |
23 filtered_java_files = [] | 25 filtered_java_files = [] |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 build_utils.CheckOutput(javac_cmd, print_stdout=options.chromium_code) | 64 build_utils.CheckOutput(javac_cmd, print_stdout=options.chromium_code) |
63 | 65 |
64 record_path = '%s/javac.md5.stamp' % options.output_dir | 66 record_path = '%s/javac.md5.stamp' % options.output_dir |
65 md5_check.CallAndRecordIfStale( | 67 md5_check.CallAndRecordIfStale( |
66 Compile, | 68 Compile, |
67 record_path=record_path, | 69 record_path=record_path, |
68 input_paths=java_files + jar_inputs, | 70 input_paths=java_files + jar_inputs, |
69 input_strings=javac_cmd) | 71 input_strings=javac_cmd) |
70 | 72 |
71 | 73 |
72 def main(argv): | 74 def main(): |
73 parser = optparse.OptionParser() | 75 parser = optparse.OptionParser() |
74 parser.add_option('--src-dirs', help='Directories containing java files.') | 76 parser.add_option('--src-dirs', help='Directories containing java files.') |
75 parser.add_option('--javac-includes', | 77 parser.add_option('--javac-includes', |
76 help='A list of file patterns. If provided, only java files that match' + | 78 help='A list of file patterns. If provided, only java files that match' + |
77 'one of the patterns will be compiled.') | 79 'one of the patterns will be compiled.') |
78 parser.add_option('--classpath', help='Classpath for javac.') | 80 parser.add_option('--classpath', help='Classpath for javac.') |
79 parser.add_option('--output-dir', help='Directory for javac output.') | 81 parser.add_option('--output-dir', help='Directory for javac output.') |
80 parser.add_option('--stamp', help='Path to touch on success.') | 82 parser.add_option('--stamp', help='Path to touch on success.') |
81 parser.add_option('--chromium-code', type='int', help='Whether code being ' | 83 parser.add_option('--chromium-code', type='int', help='Whether code being ' |
82 'compiled should be built with stricter warnings for ' | 84 'compiled should be built with stricter warnings for ' |
83 'chromium code.') | 85 'chromium code.') |
84 | 86 |
85 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. | 87 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. |
86 parser.add_option('--ignore', help='Ignored.') | 88 parser.add_option('--ignore', help='Ignored.') |
87 | 89 |
88 options, _ = parser.parse_args() | 90 options, _ = parser.parse_args() |
89 | 91 |
90 DoJavac(options) | 92 DoJavac(options) |
91 | 93 |
92 if options.stamp: | 94 if options.stamp: |
93 build_utils.Touch(options.stamp) | 95 build_utils.Touch(options.stamp) |
94 | 96 |
95 | 97 |
96 if __name__ == '__main__': | 98 if __name__ == '__main__': |
97 sys.exit(main(sys.argv)) | 99 sys.exit(main()) |
98 | 100 |
99 | 101 |
OLD | NEW |