Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Side by Side Diff: build/android/gyp/javac.py

Issue 1706363003: Fix javac sometimes not create all outputs with enable_incremental_javac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missing if Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 options.incremental:
234 if os.path.exists(pdb_path) and not os.path.getsize(pdb_path):
235 os.unlink(pdb_path)
236
231 # Don't include the output directory in the initial set of args since it 237 # 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). 238 # being in a temp dir makes it unstable (breaks md5 stamping).
233 cmd = javac_cmd + ['-d', classes_dir] + java_files 239 cmd = javac_cmd + ['-d', classes_dir] + java_files
234 240
235 # JMake prints out some diagnostic logs that we want to ignore. 241 # JMake prints out some diagnostic logs that we want to ignore.
236 # This assumes that all compiler output goes through stderr. 242 # This assumes that all compiler output goes through stderr.
237 stdout_filter = lambda s: '' 243 stdout_filter = lambda s: ''
238 if md5_check.PRINT_EXPLANATIONS: 244 if md5_check.PRINT_EXPLANATIONS:
239 stdout_filter = None 245 stdout_filter = None
240 246
241 attempt_build = lambda: build_utils.CheckOutput( 247 attempt_build = lambda: build_utils.CheckOutput(
242 cmd, 248 cmd,
243 print_stdout=options.chromium_code, 249 print_stdout=options.chromium_code,
244 stdout_filter=stdout_filter, 250 stdout_filter=stdout_filter,
245 stderr_filter=ColorJavacOutput) 251 stderr_filter=ColorJavacOutput)
246 try: 252 try:
247 attempt_build() 253 attempt_build()
248 except build_utils.CalledProcessError as e: 254 except build_utils.CalledProcessError as e:
249 # Work-around for a bug in jmake (http://crbug.com/551449). 255 # Work-around for a bug in jmake (http://crbug.com/551449).
250 if 'project database corrupted' not in e.output: 256 if 'project database corrupted' not in e.output:
251 raise 257 raise
252 print ('Applying work-around for jmake project database corrupted ' 258 print ('Applying work-around for jmake project database corrupted '
253 '(http://crbug.com/551449).') 259 '(http://crbug.com/551449).')
254 os.unlink(pdb_path) 260 os.unlink(pdb_path)
255 attempt_build() 261 attempt_build()
262 elif options.incremental:
263 # Make sure output exists.
264 build_utils.Touch(pdb_path)
256 265
257 if options.main_class or options.manifest_entry: 266 if options.main_class or options.manifest_entry:
258 entries = [] 267 entries = []
259 if options.manifest_entry: 268 if options.manifest_entry:
260 entries = [e.split(':') for e in options.manifest_entry] 269 entries = [e.split(':') for e in options.manifest_entry]
261 manifest_file = os.path.join(temp_dir, 'manifest') 270 manifest_file = os.path.join(temp_dir, 'manifest')
262 _CreateManifest(manifest_file, runtime_classpath, options.main_class, 271 _CreateManifest(manifest_file, runtime_classpath, options.main_class,
263 entries) 272 entries)
264 else: 273 else:
265 manifest_file = None 274 manifest_file = None
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 options, 457 options,
449 input_paths=input_paths, 458 input_paths=input_paths,
450 input_strings=javac_cmd, 459 input_strings=javac_cmd,
451 output_paths=output_paths, 460 output_paths=output_paths,
452 force=force, 461 force=force,
453 pass_changes=True) 462 pass_changes=True)
454 463
455 464
456 if __name__ == '__main__': 465 if __name__ == '__main__':
457 sys.exit(main(sys.argv[1:])) 466 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698