Index: build/android/gyp/javac.py |
diff --git a/build/android/gyp/javac.py b/build/android/gyp/javac.py |
index 15fe73db49827fed77692a61bd9aded108664d8d..37380629ebf2a045d1990b979b96fb76efd89898 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): |
"""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,13 @@ def main(argv): |
java_files) |
if options.jar_path: |
- if options.main_class: |
+ if options.main_class or options.manifest_entry: |
+ if options.manifest_entry: |
+ entries = map(lambda e: e.split(":"), options.manifest_entry) |
+ else: |
+ entries = [] |
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, |