Index: build/android/gyp/rewrite_deconstruct_manifest.py |
diff --git a/build/android/gyp/rewrite_deconstruct_manifest.py b/build/android/gyp/rewrite_deconstruct_manifest.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fed0181965c22d95f8af0eb5456d9d22cbb0f08f |
--- /dev/null |
+++ b/build/android/gyp/rewrite_deconstruct_manifest.py |
@@ -0,0 +1,44 @@ |
+# Copyright 2014 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+import argparse |
+import os |
+import re |
+import shutil |
+import sys |
+import xml.etree.ElementTree |
+ |
+from xml.dom import minidom |
+ |
+from util import build_utils |
+ |
+DECONSTRUCTED_APPLICATION = 'org.chromium.deconstructed.DeconstructedApplication' |
+ |
+def main(args): |
+ parser = argparse.ArgumentParser() |
+ parser.add_argument('--in-manifest') |
+ parser.add_argument('--out-manifest') |
+ parser.add_argument('--out-data') |
+ options = parser.parse_args(args) |
+ |
+ manifest_xml = xml.etree.ElementTree.parse(options.in_manifest) |
+ manifest = manifest_xml.getroot() |
+ app_list = manifest.findall('application') |
+ if len(app_list) != 1: |
+ return 1 |
+ app_node = app_list[0] |
+ |
+ name_key = '{http://schemas.android.com/apk/res/android}name' |
+ old_application = app_node.get(name_key) |
+ app_node.set(name_key, DECONSTRUCTED_APPLICATION) |
+ package = manifest.get('package') |
+ |
+ manifest_xml.write(options.out_manifest) |
+ with open(options.out_data, 'w') as outfile: |
+ outfile.write('\n'.join([package, old_application])) |
+ |
+ |
+if __name__ == "__main__": |
+ main(sys.argv[1:]) |
+ |