| Index: build/android/gyp/jar.py
|
| diff --git a/build/android/gyp/jar.py b/build/android/gyp/jar.py
|
| index e5b8451bc42580b27169bd9b4f62b362392d103e..d3636d71418e2e9038980e096c51bf5093b2da21 100755
|
| --- a/build/android/gyp/jar.py
|
| +++ b/build/android/gyp/jar.py
|
| @@ -12,31 +12,35 @@ import sys
|
| from util import build_utils
|
| from util import md5_check
|
|
|
| -
|
| -def DoJar(options):
|
| - class_files = build_utils.FindInDirectory(options.classes_dir, '*.class')
|
| - for exclude in build_utils.ParseGypList(options.excluded_classes):
|
| - class_files = filter(
|
| - lambda f: not fnmatch.fnmatch(f, exclude), class_files)
|
| -
|
| - jar_path = os.path.abspath(options.jar_path)
|
| +def Jar(class_files, classes_dir, jar_path):
|
| + jar_path = os.path.abspath(jar_path)
|
|
|
| # The paths of the files in the jar will be the same as they are passed in to
|
| # the command. Because of this, the command should be run in
|
| # options.classes_dir so the .class file paths in the jar are correct.
|
| - jar_cwd = options.classes_dir
|
| + jar_cwd = classes_dir
|
| class_files_rel = [os.path.relpath(f, jar_cwd) for f in class_files]
|
| jar_cmd = ['jar', 'cf0', jar_path] + class_files_rel
|
|
|
| - record_path = '%s.md5.stamp' % options.jar_path
|
| + record_path = '%s.md5.stamp' % jar_path
|
| md5_check.CallAndRecordIfStale(
|
| lambda: build_utils.CheckOutput(jar_cmd, cwd=jar_cwd),
|
| record_path=record_path,
|
| input_paths=class_files,
|
| - input_strings=jar_cmd)
|
| + input_strings=jar_cmd,
|
| + force=not os.path.exists(jar_path),
|
| + )
|
|
|
| - build_utils.Touch(options.jar_path)
|
| + build_utils.Touch(jar_path, fail_if_missing=True)
|
| +
|
| +
|
| +def JarDirectory(classes_dir, excluded_classes, jar_path):
|
| + class_files = build_utils.FindInDirectory(classes_dir, '*.class')
|
| + for exclude in excluded_classes:
|
| + class_files = filter(
|
| + lambda f: not fnmatch.fnmatch(f, exclude), class_files)
|
|
|
| + Jar(class_files, classes_dir, jar_path)
|
|
|
| def main():
|
| parser = optparse.OptionParser()
|
| @@ -48,7 +52,9 @@ def main():
|
|
|
| options, _ = parser.parse_args()
|
|
|
| - DoJar(options)
|
| + JarDirectory(options.classes_dir,
|
| + build_utils.ParseGypList(options.excluded_classes),
|
| + options.jar_path)
|
|
|
| if options.stamp:
|
| build_utils.Touch(options.stamp)
|
|
|