Chromium Code Reviews| Index: build/android/gyp/javac.py |
| diff --git a/build/android/gyp/javac.py b/build/android/gyp/javac.py |
| index 15fe73db49827fed77692a61bd9aded108664d8d..7b0bfc8ff4c435f681ab88b025e5b1d07fc724bc 100755 |
| --- a/build/android/gyp/javac.py |
| +++ b/build/android/gyp/javac.py |
| @@ -106,7 +106,8 @@ def DoJavac( |
| _MAX_MANIFEST_LINE_LEN = 72 |
| -def CreateManifest(manifest_path, classpath, main_class=None): |
| +def CreateManifest(manifest_path, classpath, main_class=None, |
| + manifest_entries=None): |
|
qsr
2015/02/10 11:58:18
This should be done upstream. Anything in /build/
etiennej
2015/02/10 14:32:04
CL in review.
|
| """Creates a manifest file with the given parameters. |
| This generates a manifest file that compiles with the spec found at |
| @@ -117,11 +118,16 @@ def CreateManifest(manifest_path, classpath, main_class=None): |
| classpath: The JAR files that should be listed on the manifest file's |
| classpath. |
| main_class: If present, the class containing the main() function. |
| + manifest_entries: If present, a list of (key, value) pairs to add to |
| + the manifest. |
| """ |
| output = ['Manifest-Version: 1.0'] |
| if main_class: |
| output.append('Main-Class: %s' % main_class) |
| + if manifest_entries: |
| + for k, v in manifest_entries: |
| + output.append('%s: %s' % (k, v)) |
| if classpath: |
| sanitized_paths = [] |
| for path in classpath: |
| @@ -183,6 +189,10 @@ def main(argv): |
| parser.add_option( |
| '--main-class', |
| help='The class containing the main method.') |
| + parser.add_option( |
| + '--manifest-entry', |
| + action='append', |
| + help='Key:value pairs to add to the .jar manifest.') |
| parser.add_option('--stamp', help='Path to touch on success.') |
| @@ -232,10 +242,10 @@ def main(argv): |
| java_files) |
| if options.jar_path: |
| - if options.main_class: |
| + if options.main_class or options.manifest_entry: |
| + entries = map(lambda e: e.split(":"), options.manifest_entry) |
| manifest_file = os.path.join(temp_dir, 'manifest') |
| - CreateManifest(manifest_file, classpath, |
| - options.main_class) |
| + CreateManifest(manifest_file, classpath, options.main_class, entries) |
| else: |
| manifest_file = None |
| jar.JarDirectory(classes_dir, |