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

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

Issue 2712973002: Revert of Fix up javac.py's depfile to include all relevant inputs (Closed)
Patch Set: Created 3 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 distutils.spawn 7 import distutils.spawn
8 import optparse 8 import optparse
9 import os 9 import os
10 import shutil 10 import shutil
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 colorama.init() 413 colorama.init()
414 414
415 argv = build_utils.ExpandFileArgs(argv) 415 argv = build_utils.ExpandFileArgs(argv)
416 options, java_files = _ParseOptions(argv) 416 options, java_files = _ParseOptions(argv)
417 417
418 if options.src_gendirs: 418 if options.src_gendirs:
419 java_files += build_utils.FindInDirectories(options.src_gendirs, '*.java') 419 java_files += build_utils.FindInDirectories(options.src_gendirs, '*.java')
420 420
421 java_files = _FilterJavaFiles(java_files, options.javac_includes) 421 java_files = _FilterJavaFiles(java_files, options.javac_includes)
422 422
423 javac_cmd = ['javac']
423 if options.use_errorprone_path: 424 if options.use_errorprone_path:
424 javac_path = options.use_errorprone_path 425 javac_cmd = [options.use_errorprone_path] + ERRORPRONE_OPTIONS
425 javac_cmd = [javac_path] + ERRORPRONE_OPTIONS
426 else:
427 javac_path = distutils.spawn.find_executable('javac')
428 javac_cmd = [javac_path]
429 426
430 javac_cmd.extend(( 427 javac_cmd.extend((
431 '-g', 428 '-g',
432 # Chromium only allows UTF8 source files. Being explicit avoids 429 # Chromium only allows UTF8 source files. Being explicit avoids
433 # javac pulling a default encoding from the user's environment. 430 # javac pulling a default encoding from the user's environment.
434 '-encoding', 'UTF-8', 431 '-encoding', 'UTF-8',
435 # Make sure we do not pass an empty string to -classpath and -sourcepath. 432 # Make sure we do not pass an empty string to -classpath and -sourcepath.
436 '-classpath', ':'.join(options.classpath) or ':', 433 '-classpath', ':'.join(options.classpath) or ':',
437 # Prevent compiler from compiling .java files not listed as inputs. 434 # Prevent compiler from compiling .java files not listed as inputs.
438 # See: http://blog.ltgt.net/most-build-tools-misuse-javac/ 435 # See: http://blog.ltgt.net/most-build-tools-misuse-javac/
(...skipping 30 matching lines...) Expand all
469 if options.classpath[0].endswith('.interface.jar'): 466 if options.classpath[0].endswith('.interface.jar'):
470 classpath_inputs.extend(options.classpath) 467 classpath_inputs.extend(options.classpath)
471 else: 468 else:
472 # TODO(agrieve): Remove this .TOC heuristic once GYP is no more. 469 # TODO(agrieve): Remove this .TOC heuristic once GYP is no more.
473 for path in options.classpath: 470 for path in options.classpath:
474 if os.path.exists(path + '.TOC'): 471 if os.path.exists(path + '.TOC'):
475 classpath_inputs.append(path + '.TOC') 472 classpath_inputs.append(path + '.TOC')
476 else: 473 else:
477 classpath_inputs.append(path) 474 classpath_inputs.append(path)
478 475
479 # GN already knows of java_files, so listing them just make things worse when 476 # Compute the list of paths that when changed, we need to rebuild.
480 # they change. 477 input_paths = classpath_inputs + options.java_srcjars + java_files
481 depfile_deps = [javac_path] + classpath_inputs + options.java_srcjars
482 input_paths = depfile_deps + java_files
483 478
484 output_paths = [ 479 output_paths = [
485 options.jar_path, 480 options.jar_path,
486 options.jar_path.replace('.jar', '.excluded.jar'), 481 options.jar_path.replace('.jar', '.excluded.jar'),
487 ] 482 ]
488 if options.incremental: 483 if options.incremental:
489 output_paths.append(options.jar_path + '.pdb') 484 output_paths.append(options.jar_path + '.pdb')
490 485
491 # An escape hatch to be able to check if incremental compiles are causing 486 # An escape hatch to be able to check if incremental compiles are causing
492 # problems. 487 # problems.
493 force = int(os.environ.get('DISABLE_INCREMENTAL_JAVAC', 0)) 488 force = int(os.environ.get('DISABLE_INCREMENTAL_JAVAC', 0))
494 489
495 # List python deps in input_strings rather than input_paths since the contents 490 # List python deps in input_strings rather than input_paths since the contents
496 # of them does not change what gets written to the depsfile. 491 # of them does not change what gets written to the depsfile.
497 build_utils.CallAndWriteDepfileIfStale( 492 build_utils.CallAndWriteDepfileIfStale(
498 lambda changes: _OnStaleMd5(changes, options, javac_cmd, java_files, 493 lambda changes: _OnStaleMd5(changes, options, javac_cmd, java_files,
499 classpath_inputs), 494 classpath_inputs),
500 options, 495 options,
501 depfile_deps=depfile_deps,
502 input_paths=input_paths, 496 input_paths=input_paths,
503 input_strings=javac_cmd, 497 input_strings=javac_cmd,
504 output_paths=output_paths, 498 output_paths=output_paths,
505 force=force, 499 force=force,
506 pass_changes=True) 500 pass_changes=True)
507 501
508 502
509 if __name__ == '__main__': 503 if __name__ == '__main__':
510 sys.exit(main(sys.argv[1:])) 504 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