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

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

Issue 1361733002: Make javac invocations incremental when possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@apkbuilder
Patch Set: add flag and disable by default Created 5 years, 3 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 | build/android/gyp/javac.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 optparse 7 import optparse
8 import os 8 import os
9 import sys 9 import sys
10 10
(...skipping 15 matching lines...) Expand all
26 jar_cmd.extend(class_files_rel) 26 jar_cmd.extend(class_files_rel)
27 27
28 with build_utils.TempDir() as temp_dir: 28 with build_utils.TempDir() as temp_dir:
29 empty_file = os.path.join(temp_dir, '.empty') 29 empty_file = os.path.join(temp_dir, '.empty')
30 build_utils.Touch(empty_file) 30 build_utils.Touch(empty_file)
31 jar_cmd.append(os.path.relpath(empty_file, jar_cwd)) 31 jar_cmd.append(os.path.relpath(empty_file, jar_cwd))
32 build_utils.CheckOutput(jar_cmd, cwd=jar_cwd) 32 build_utils.CheckOutput(jar_cmd, cwd=jar_cwd)
33 build_utils.Touch(jar_path, fail_if_missing=True) 33 build_utils.Touch(jar_path, fail_if_missing=True)
34 34
35 35
36 def JarDirectory(classes_dir, excluded_classes, jar_path, manifest_file=None): 36 def JarDirectory(classes_dir, jar_path, manifest_file=None, predicate=None):
37 class_files = build_utils.FindInDirectory(classes_dir, '*.class') 37 class_files = build_utils.FindInDirectory(classes_dir, '*.class')
38 class_files = [f for f in class_files 38 if predicate:
39 if not build_utils.MatchesGlob(f, excluded_classes)] 39 class_files = [f for f in class_files if predicate(f)]
40 40
41 Jar(class_files, classes_dir, jar_path, manifest_file=manifest_file) 41 Jar(class_files, classes_dir, jar_path, manifest_file=manifest_file)
42 42
43 43
44 def main(): 44 def main():
45 parser = optparse.OptionParser() 45 parser = optparse.OptionParser()
46 parser.add_option('--classes-dir', help='Directory containing .class files.') 46 parser.add_option('--classes-dir', help='Directory containing .class files.')
47 parser.add_option('--jar-path', help='Jar output path.') 47 parser.add_option('--jar-path', help='Jar output path.')
48 parser.add_option('--excluded-classes', 48 parser.add_option('--excluded-classes',
49 help='List of .class file patterns to exclude from the jar.') 49 help='List of .class file patterns to exclude from the jar.')
50 parser.add_option('--stamp', help='Path to touch on success.') 50 parser.add_option('--stamp', help='Path to touch on success.')
51 51
52 options, _ = parser.parse_args() 52 options, _ = parser.parse_args()
53 53
54 predicate = None
54 if options.excluded_classes: 55 if options.excluded_classes:
55 excluded_classes = build_utils.ParseGypList(options.excluded_classes) 56 excluded_classes = build_utils.ParseGypList(options.excluded_classes)
56 else: 57 predicate = lambda f: not build_utils.MatchesGlob(f, excluded_classes)
57 excluded_classes = [] 58
58 JarDirectory(options.classes_dir, 59 JarDirectory(options.classes_dir, options.jar_path, predicate=predicate)
59 excluded_classes,
60 options.jar_path)
61 60
62 if options.stamp: 61 if options.stamp:
63 build_utils.Touch(options.stamp) 62 build_utils.Touch(options.stamp)
64 63
65 64
66 if __name__ == '__main__': 65 if __name__ == '__main__':
67 sys.exit(main()) 66 sys.exit(main())
68 67
OLDNEW
« no previous file with comments | « no previous file | build/android/gyp/javac.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698