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

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

Issue 14263006: [Android] Refactor md5_check + add tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@java_toc
Patch Set: Rebase Created 7 years, 8 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 | « build/android/gyp/jar_toc.py ('k') | build/android/gyp/push_libraries.py » ('j') | 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 fnmatch 7 import fnmatch
8 import optparse 8 import optparse
9 import os 9 import os
10 import sys 10 import sys
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 'javac', 45 'javac',
46 '-g', 46 '-g',
47 '-source', '1.5', 47 '-source', '1.5',
48 '-target', '1.5', 48 '-target', '1.5',
49 '-classpath', ':'.join(classpath), 49 '-classpath', ':'.join(classpath),
50 '-d', output_dir, 50 '-d', output_dir,
51 '-Xlint:unchecked', 51 '-Xlint:unchecked',
52 '-Xlint:deprecation', 52 '-Xlint:deprecation',
53 ] + java_files 53 ] + java_files
54 54
55 md5_stamp = '%s/javac.md5' % options.output_dir 55 def Compile():
56 md5_checker = md5_check.Md5Checker(
57 stamp=md5_stamp,
58 inputs=java_files + jar_inputs,
59 command=javac_cmd)
60 if md5_checker.IsStale():
61 # Delete the classes directory. This ensures that all .class files in the 56 # Delete the classes directory. This ensures that all .class files in the
62 # output are actually from the input .java files. For example, if a .java 57 # output are actually from the input .java files. For example, if a .java
63 # file is deleted or an inner class is removed, the classes directory should 58 # file is deleted or an inner class is removed, the classes directory should
64 # not contain the corresponding old .class file after running this action. 59 # not contain the corresponding old .class file after running this action.
65 build_utils.DeleteDirectory(output_dir) 60 build_utils.DeleteDirectory(output_dir)
66 build_utils.MakeDirectory(output_dir) 61 build_utils.MakeDirectory(output_dir)
67 suppress_output = not options.chromium_code 62 suppress_output = not options.chromium_code
68 build_utils.CheckCallDie(javac_cmd, suppress_output=suppress_output) 63 build_utils.CheckCallDie(javac_cmd, suppress_output=suppress_output)
69 md5_checker.Write() 64
65 record_path = '%s/javac.md5.stamp' % options.output_dir
66 md5_check.CallAndRecordIfStale(
67 Compile,
68 record_path=record_path,
69 input_paths=java_files + jar_inputs,
70 input_strings=javac_cmd)
71
70 72
71 def main(argv): 73 def main(argv):
72 parser = optparse.OptionParser() 74 parser = optparse.OptionParser()
73 parser.add_option('--src-dirs', help='Directories containing java files.') 75 parser.add_option('--src-dirs', help='Directories containing java files.')
74 parser.add_option('--javac-includes', 76 parser.add_option('--javac-includes',
75 help='A list of file patterns. If provided, only java files that match' + 77 help='A list of file patterns. If provided, only java files that match' +
76 'one of the patterns will be compiled.') 78 'one of the patterns will be compiled.')
77 parser.add_option('--classpath', help='Classpath for javac.') 79 parser.add_option('--classpath', help='Classpath for javac.')
78 parser.add_option('--output-dir', help='Directory for javac output.') 80 parser.add_option('--output-dir', help='Directory for javac output.')
79 parser.add_option('--stamp', help='Path to touch on success.') 81 parser.add_option('--stamp', help='Path to touch on success.')
80 parser.add_option('--chromium-code', type='int', help='Whether code being ' 82 parser.add_option('--chromium-code', type='int', help='Whether code being '
81 'compiled should be built with stricter warnings for ' 83 'compiled should be built with stricter warnings for '
82 'chromium code.') 84 'chromium code.')
83 85
84 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. 86 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
85 parser.add_option('--ignore', help='Ignored.') 87 parser.add_option('--ignore', help='Ignored.')
86 88
87 options, _ = parser.parse_args() 89 options, _ = parser.parse_args()
88 90
89 DoJavac(options) 91 DoJavac(options)
90 92
91 if options.stamp: 93 if options.stamp:
92 build_utils.Touch(options.stamp) 94 build_utils.Touch(options.stamp)
93 95
94 96
95 if __name__ == '__main__': 97 if __name__ == '__main__':
96 sys.exit(main(sys.argv)) 98 sys.exit(main(sys.argv))
97 99
98 100
OLDNEW
« no previous file with comments | « build/android/gyp/jar_toc.py ('k') | build/android/gyp/push_libraries.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698