Chromium Code Reviews| Index: build/android/gyp/jar.py |
| diff --git a/build/android/gyp/jar.py b/build/android/gyp/jar.py |
| index e5b8451bc42580b27169bd9b4f62b362392d103e..7327e736982bce87c0c70457f9a4c2f226f3d84d 100755 |
| --- a/build/android/gyp/jar.py |
| +++ b/build/android/gyp/jar.py |
| @@ -12,30 +12,38 @@ 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): |
|
Nico
2014/05/05 22:08:10
docstring
|
| + 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(jar_path, fail_if_missing=True) |
| + |
| + |
|
Nico
2014/05/05 22:08:10
style guide says: 2 empty lines between toplevel t
|
| + |
| +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(class_files, options.classes_dir, options.jar_path) |
| + |
| - build_utils.Touch(options.jar_path) |
| def main(): |