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

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

Issue 1324203002: Reland of Fix javac command never caching input .md5s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@md5-extra
Patch Set: fixed empty jars 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 fnmatch
8 import optparse 7 import optparse
9 import os 8 import os
10 import sys 9 import sys
11 10
12 from util import build_utils 11 from util import build_utils
13 from util import md5_check 12 from util import md5_check
14 13
15 14
16 def Jar(class_files, classes_dir, jar_path, manifest_file=None): 15 def Jar(class_files, classes_dir, jar_path, manifest_file=None):
17 jar_path = os.path.abspath(jar_path) 16 jar_path = os.path.abspath(jar_path)
(...skipping 20 matching lines...) Expand all
38 input_paths=class_files, 37 input_paths=class_files,
39 input_strings=jar_cmd, 38 input_strings=jar_cmd,
40 force=not os.path.exists(jar_path), 39 force=not os.path.exists(jar_path),
41 ) 40 )
42 41
43 build_utils.Touch(jar_path, fail_if_missing=True) 42 build_utils.Touch(jar_path, fail_if_missing=True)
44 43
45 44
46 def JarDirectory(classes_dir, excluded_classes, jar_path, manifest_file=None): 45 def JarDirectory(classes_dir, excluded_classes, jar_path, manifest_file=None):
47 class_files = build_utils.FindInDirectory(classes_dir, '*.class') 46 class_files = build_utils.FindInDirectory(classes_dir, '*.class')
48 for exclude in excluded_classes: 47 class_files = [f for f in class_files
49 class_files = filter( 48 if not build_utils.MatchesGlob(f, excluded_classes)]
50 lambda f: not fnmatch.fnmatch(f, exclude), class_files)
51 49
52 Jar(class_files, classes_dir, jar_path, manifest_file=manifest_file) 50 Jar(class_files, classes_dir, jar_path, manifest_file=manifest_file)
53 51
54 52
55 def main(): 53 def main():
56 parser = optparse.OptionParser() 54 parser = optparse.OptionParser()
57 parser.add_option('--classes-dir', help='Directory containing .class files.') 55 parser.add_option('--classes-dir', help='Directory containing .class files.')
58 parser.add_option('--jar-path', help='Jar output path.') 56 parser.add_option('--jar-path', help='Jar output path.')
59 parser.add_option('--excluded-classes', 57 parser.add_option('--excluded-classes',
60 help='List of .class file patterns to exclude from the jar.') 58 help='List of .class file patterns to exclude from the jar.')
61 parser.add_option('--stamp', help='Path to touch on success.') 59 parser.add_option('--stamp', help='Path to touch on success.')
62 60
63 options, _ = parser.parse_args() 61 options, _ = parser.parse_args()
64 62
65 if options.excluded_classes: 63 if options.excluded_classes:
66 excluded_classes = build_utils.ParseGypList(options.excluded_classes) 64 excluded_classes = build_utils.ParseGypList(options.excluded_classes)
67 else: 65 else:
68 excluded_classes = [] 66 excluded_classes = []
69 JarDirectory(options.classes_dir, 67 JarDirectory(options.classes_dir,
70 excluded_classes, 68 excluded_classes,
71 options.jar_path) 69 options.jar_path)
72 70
73 if options.stamp: 71 if options.stamp:
74 build_utils.Touch(options.stamp) 72 build_utils.Touch(options.stamp)
75 73
76 74
77 if __name__ == '__main__': 75 if __name__ == '__main__':
78 sys.exit(main()) 76 sys.exit(main())
79 77
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