Chromium Code Reviews| Index: build/android/gyp/jar.py |
| diff --git a/build/android/gyp/jar.py b/build/android/gyp/jar.py |
| index 3c520ed55e28d95bef6eb5de6faa3f1684cd5c52..e060f6f1a9733fb19d03ea6da483abd931c3f58a 100755 |
| --- a/build/android/gyp/jar.py |
| +++ b/build/android/gyp/jar.py |
| @@ -33,10 +33,10 @@ def Jar(class_files, classes_dir, jar_path, manifest_file=None): |
| build_utils.Touch(jar_path, fail_if_missing=True) |
| -def JarDirectory(classes_dir, excluded_classes, jar_path, manifest_file=None): |
| +def JarDirectory(classes_dir, jar_path, manifest_file=None, predicate=None): |
|
jbudorick
2015/09/23 00:26:20
Nice.
agrieve
2015/09/23 02:07:55
Acknowledged.
|
| class_files = build_utils.FindInDirectory(classes_dir, '*.class') |
| - class_files = [f for f in class_files |
| - if not build_utils.MatchesGlob(f, excluded_classes)] |
| + if predicate: |
| + class_files = [f for f in class_files if predicate(f)] |
| Jar(class_files, classes_dir, jar_path, manifest_file=manifest_file) |
| @@ -51,13 +51,12 @@ def main(): |
| options, _ = parser.parse_args() |
| + predicate = None |
| if options.excluded_classes: |
| excluded_classes = build_utils.ParseGypList(options.excluded_classes) |
| - else: |
| - excluded_classes = [] |
| - JarDirectory(options.classes_dir, |
| - excluded_classes, |
| - options.jar_path) |
| + predicate = lambda f: not build_utils.MatchesGlob(f, excluded_classes) |
| + |
| + JarDirectory(options.classes_dir, options.jar_path, predicate=predicate) |
| if options.stamp: |
| build_utils.Touch(options.stamp) |