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 shutil | 9 import shutil |
10 import re | 10 import re |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 skip_next = False | 143 skip_next = False |
144 for arg in javac_cmd[1:]: | 144 for arg in javac_cmd[1:]: |
145 if not skip_next and arg not in do_not_prefix: | 145 if not skip_next and arg not in do_not_prefix: |
146 arg = '-C' + arg | 146 arg = '-C' + arg |
147 new_args.append(arg) | 147 new_args.append(arg) |
148 skip_next = arg in do_not_prefix | 148 skip_next = arg in do_not_prefix |
149 | 149 |
150 return new_args | 150 return new_args |
151 | 151 |
152 | 152 |
153 def _FilterJMakeOutput(stdout): | |
154 if md5_check.PRINT_EXPLANATIONS: | |
155 return stdout | |
156 return re.sub(r'\b(Jmake version|Writing project database).*?\n', '', stdout) | |
157 | |
158 | |
159 def _FixTempPathsInIncrementalMetadata(pdb_path, temp_dir): | 153 def _FixTempPathsInIncrementalMetadata(pdb_path, temp_dir): |
160 # The .pdb records absolute paths. Fix up paths within /tmp (srcjars). | 154 # The .pdb records absolute paths. Fix up paths within /tmp (srcjars). |
161 if os.path.exists(pdb_path): | 155 if os.path.exists(pdb_path): |
162 # Although its a binary file, search/replace still seems to work fine. | 156 # Although its a binary file, search/replace still seems to work fine. |
163 with open(pdb_path) as fileobj: | 157 with open(pdb_path) as fileobj: |
164 pdb_data = fileobj.read() | 158 pdb_data = fileobj.read() |
165 with open(pdb_path, 'w') as fileobj: | 159 with open(pdb_path, 'w') as fileobj: |
166 fileobj.write(re.sub(r'/tmp/[^/]*', temp_dir, pdb_data)) | 160 fileobj.write(re.sub(r'/tmp/[^/]*', temp_dir, pdb_data)) |
167 | 161 |
168 | 162 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 # Add the extracted files to the classpath. This is required because | 224 # Add the extracted files to the classpath. This is required because |
231 # when compiling only a subset of files, classes that haven't changed | 225 # when compiling only a subset of files, classes that haven't changed |
232 # need to be findable. | 226 # need to be findable. |
233 classpath_idx = javac_cmd.index('-classpath') | 227 classpath_idx = javac_cmd.index('-classpath') |
234 javac_cmd[classpath_idx + 1] += ':' + classes_dir | 228 javac_cmd[classpath_idx + 1] += ':' + classes_dir |
235 | 229 |
236 # Don't include the output directory in the initial set of args since it | 230 # Don't include the output directory in the initial set of args since it |
237 # being in a temp dir makes it unstable (breaks md5 stamping). | 231 # being in a temp dir makes it unstable (breaks md5 stamping). |
238 cmd = javac_cmd + ['-d', classes_dir] + java_files | 232 cmd = javac_cmd + ['-d', classes_dir] + java_files |
239 | 233 |
| 234 # JMake prints out some diagnostic logs that we want to ignore. |
| 235 # This assumes that all compiler output goes through stderr. |
| 236 stdout_filter = lambda s: '' |
| 237 if md5_check.PRINT_EXPLANATIONS: |
| 238 stdout_filter = None |
| 239 |
240 build_utils.CheckOutput( | 240 build_utils.CheckOutput( |
241 cmd, | 241 cmd, |
242 print_stdout=options.chromium_code, | 242 print_stdout=options.chromium_code, |
243 stdout_filter=_FilterJMakeOutput, | 243 stdout_filter=stdout_filter, |
244 stderr_filter=ColorJavacOutput) | 244 stderr_filter=ColorJavacOutput) |
245 | 245 |
246 if options.main_class or options.manifest_entry: | 246 if options.main_class or options.manifest_entry: |
247 entries = [] | 247 entries = [] |
248 if options.manifest_entry: | 248 if options.manifest_entry: |
249 entries = [e.split(':') for e in options.manifest_entry] | 249 entries = [e.split(':') for e in options.manifest_entry] |
250 manifest_file = os.path.join(temp_dir, 'manifest') | 250 manifest_file = os.path.join(temp_dir, 'manifest') |
251 _CreateManifest(manifest_file, runtime_classpath, options.main_class, | 251 _CreateManifest(manifest_file, runtime_classpath, options.main_class, |
252 entries) | 252 entries) |
253 else: | 253 else: |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 options, | 437 options, |
438 input_paths=input_paths, | 438 input_paths=input_paths, |
439 input_strings=javac_cmd, | 439 input_strings=javac_cmd, |
440 output_paths=output_paths, | 440 output_paths=output_paths, |
441 force=force, | 441 force=force, |
442 pass_changes=True) | 442 pass_changes=True) |
443 | 443 |
444 | 444 |
445 if __name__ == '__main__': | 445 if __name__ == '__main__': |
446 sys.exit(main(sys.argv[1:])) | 446 sys.exit(main(sys.argv[1:])) |
OLD | NEW |