Chromium Code Reviews| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 if os.path.exists(options.jar_path): | 221 if os.path.exists(options.jar_path): |
| 222 _ExtractClassFiles(options.jar_path, classes_dir, changed_java_files) | 222 _ExtractClassFiles(options.jar_path, classes_dir, changed_java_files) |
| 223 if os.path.exists(excluded_jar_path): | 223 if os.path.exists(excluded_jar_path): |
| 224 _ExtractClassFiles(excluded_jar_path, classes_dir, changed_java_files) | 224 _ExtractClassFiles(excluded_jar_path, classes_dir, changed_java_files) |
| 225 # Add the extracted files to the classpath. This is required because | 225 # Add the extracted files to the classpath. This is required because |
| 226 # when compiling only a subset of files, classes that haven't changed | 226 # when compiling only a subset of files, classes that haven't changed |
| 227 # need to be findable. | 227 # need to be findable. |
| 228 classpath_idx = javac_cmd.index('-classpath') | 228 classpath_idx = javac_cmd.index('-classpath') |
| 229 javac_cmd[classpath_idx + 1] += ':' + classes_dir | 229 javac_cmd[classpath_idx + 1] += ':' + classes_dir |
| 230 | 230 |
| 231 # Can happen when a target goes from having no sources, to having sources. | |
| 232 # It's created by the call to build_utils.Touch() below. | |
| 233 if os.path.exists(pdb_path) and not os.path.getsize(pdb_path): | |
|
nyquist
2016/02/19 20:57:12
Nit: Should you add if options.incremental here? O
agrieve
2016/02/23 02:55:21
The bots agree with you! Done.
| |
| 234 os.unlink(pdb_path) | |
| 235 | |
| 231 # Don't include the output directory in the initial set of args since it | 236 # Don't include the output directory in the initial set of args since it |
| 232 # being in a temp dir makes it unstable (breaks md5 stamping). | 237 # being in a temp dir makes it unstable (breaks md5 stamping). |
| 233 cmd = javac_cmd + ['-d', classes_dir] + java_files | 238 cmd = javac_cmd + ['-d', classes_dir] + java_files |
| 234 | 239 |
| 235 # JMake prints out some diagnostic logs that we want to ignore. | 240 # JMake prints out some diagnostic logs that we want to ignore. |
| 236 # This assumes that all compiler output goes through stderr. | 241 # This assumes that all compiler output goes through stderr. |
| 237 stdout_filter = lambda s: '' | 242 stdout_filter = lambda s: '' |
| 238 if md5_check.PRINT_EXPLANATIONS: | 243 if md5_check.PRINT_EXPLANATIONS: |
| 239 stdout_filter = None | 244 stdout_filter = None |
| 240 | 245 |
| 241 attempt_build = lambda: build_utils.CheckOutput( | 246 attempt_build = lambda: build_utils.CheckOutput( |
| 242 cmd, | 247 cmd, |
| 243 print_stdout=options.chromium_code, | 248 print_stdout=options.chromium_code, |
| 244 stdout_filter=stdout_filter, | 249 stdout_filter=stdout_filter, |
| 245 stderr_filter=ColorJavacOutput) | 250 stderr_filter=ColorJavacOutput) |
| 246 try: | 251 try: |
| 247 attempt_build() | 252 attempt_build() |
| 248 except build_utils.CalledProcessError as e: | 253 except build_utils.CalledProcessError as e: |
| 249 # Work-around for a bug in jmake (http://crbug.com/551449). | 254 # Work-around for a bug in jmake (http://crbug.com/551449). |
| 250 if 'project database corrupted' not in e.output: | 255 if 'project database corrupted' not in e.output: |
| 251 raise | 256 raise |
| 252 print ('Applying work-around for jmake project database corrupted ' | 257 print ('Applying work-around for jmake project database corrupted ' |
| 253 '(http://crbug.com/551449).') | 258 '(http://crbug.com/551449).') |
| 254 os.unlink(pdb_path) | 259 os.unlink(pdb_path) |
| 255 attempt_build() | 260 attempt_build() |
| 261 elif options.incremental: | |
| 262 # Make sure output exists. | |
| 263 build_utils.Touch(pdb_path) | |
| 256 | 264 |
| 257 if options.main_class or options.manifest_entry: | 265 if options.main_class or options.manifest_entry: |
| 258 entries = [] | 266 entries = [] |
| 259 if options.manifest_entry: | 267 if options.manifest_entry: |
| 260 entries = [e.split(':') for e in options.manifest_entry] | 268 entries = [e.split(':') for e in options.manifest_entry] |
| 261 manifest_file = os.path.join(temp_dir, 'manifest') | 269 manifest_file = os.path.join(temp_dir, 'manifest') |
| 262 _CreateManifest(manifest_file, runtime_classpath, options.main_class, | 270 _CreateManifest(manifest_file, runtime_classpath, options.main_class, |
| 263 entries) | 271 entries) |
| 264 else: | 272 else: |
| 265 manifest_file = None | 273 manifest_file = None |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 448 options, | 456 options, |
| 449 input_paths=input_paths, | 457 input_paths=input_paths, |
| 450 input_strings=javac_cmd, | 458 input_strings=javac_cmd, |
| 451 output_paths=output_paths, | 459 output_paths=output_paths, |
| 452 force=force, | 460 force=force, |
| 453 pass_changes=True) | 461 pass_changes=True) |
| 454 | 462 |
| 455 | 463 |
| 456 if __name__ == '__main__': | 464 if __name__ == '__main__': |
| 457 sys.exit(main(sys.argv[1:])) | 465 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |