Chromium Code Reviews| Index: build/android/gyp/jar.py |
| diff --git a/build/android/gyp/jar.py b/build/android/gyp/jar.py |
| index d3636d71418e2e9038980e096c51bf5093b2da21..1f81ec37b819098ebd5a71b933793dd5afcfc43f 100755 |
| --- a/build/android/gyp/jar.py |
| +++ b/build/android/gyp/jar.py |
| @@ -12,7 +12,8 @@ import sys |
| from util import build_utils |
| from util import md5_check |
| -def Jar(class_files, classes_dir, jar_path): |
| + |
| +def Jar(class_files, classes_dir, jar_path, manifest_file=None): |
|
cjhopman
2014/09/15 22:27:36
I would like to actually get rid of jar.py. javac.
jbudorick
2014/09/16 02:50:40
This has to keep some manifest logic since javac.p
|
| 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 |
| @@ -20,7 +21,11 @@ def Jar(class_files, classes_dir, jar_path): |
| # options.classes_dir so the .class file paths in the jar are correct. |
| 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 |
| + jar_cmd = ['jar', 'cf0', jar_path] |
| + if manifest_file: |
| + jar_cmd[1] += 'm' |
| + jar_cmd.append(os.path.abspath(manifest_file)) |
| + jar_cmd.extend(class_files_rel) |
| record_path = '%s.md5.stamp' % jar_path |
| md5_check.CallAndRecordIfStale( |
| @@ -34,13 +39,14 @@ def Jar(class_files, classes_dir, jar_path): |
| build_utils.Touch(jar_path, fail_if_missing=True) |
| -def JarDirectory(classes_dir, excluded_classes, jar_path): |
| +def JarDirectory(classes_dir, excluded_classes, jar_path, manifest_file=None): |
| 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) |
| + Jar(class_files, classes_dir, jar_path, manifest_file=manifest_file) |
| + |
| def main(): |
| parser = optparse.OptionParser() |
| @@ -49,12 +55,18 @@ def main(): |
| parser.add_option('--excluded-classes', |
| help='List of .class file patterns to exclude from the jar.') |
| parser.add_option('--stamp', help='Path to touch on success.') |
| + parser.add_option('--manifest-file', help='The manifest file.') |
| options, _ = parser.parse_args() |
| + if options.excluded_classes: |
| + excluded_classes = build_utils.ParseGypList(options.excluded_classes) |
| + else: |
| + excluded_classes = [] |
| JarDirectory(options.classes_dir, |
| - build_utils.ParseGypList(options.excluded_classes), |
| - options.jar_path) |
| + excluded_classes, |
| + options.jar_path, |
| + manifest_file=options.manifest_file) |
| if options.stamp: |
| build_utils.Touch(options.stamp) |