Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: build/android/incremental_install/generate_android_manifest.py

Issue 1352043007: GN: Make _incremental apk targets work when no <application> exists (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/incremental_install/generate_android_manifest.py
diff --git a/build/android/incremental_install/generate_android_manifest.py b/build/android/incremental_install/generate_android_manifest.py
index b9061ed89fa87079c38371290501b055b33e604f..17eabd4d9ab8ba6d7372c30e7375de1bb36ecce8 100755
--- a/build/android/incremental_install/generate_android_manifest.py
+++ b/build/android/incremental_install/generate_android_manifest.py
@@ -22,6 +22,7 @@ ElementTree.register_namespace('android', _ANDROID_NAMESPACE)
_INCREMENTAL_APP_NAME = 'org.chromium.incrementalinstall.BootstrapApplication'
_META_DATA_NAME = 'incremental-install-real-app'
+_DEFAULT_APPLICATION_CLASS = 'android.app.Application'
def _AddNamespace(name):
@@ -44,13 +45,11 @@ def _ParseArgs():
return parser.parse_args()
-def _ProcessManifest(main_manifest, main_manifest_path,
- disable_isolated_processes):
+def _ProcessManifest(main_manifest, disable_isolated_processes):
"""Returns a transformed AndroidManifest.xml for use with _incremental apks.
Args:
main_manifest: Manifest contents to transform.
- main_manifest_path: Path to main_manifest (used for error messages).
disable_isolated_processes: Whether to set all isolatedProcess attributes to
false
@@ -64,11 +63,10 @@ def _ProcessManifest(main_manifest, main_manifest_path,
doc = ElementTree.fromstring(main_manifest)
app_node = doc.find('application')
if app_node is None:
- raise Exception('Could not find <application> in %s' % main_manifest_path)
- real_app_class = app_node.get(_AddNamespace('name'))
- if real_app_class is None:
- raise Exception('Could not find android:name in <application> in %s' %
- main_manifest_path)
+ app_node = ElementTree.SubElement(doc, 'application')
+
+ real_app_class = app_node.get(_AddNamespace('name'),
+ _DEFAULT_APPLICATION_CLASS)
app_node.set(_AddNamespace('name'), _INCREMENTAL_APP_NAME)
meta_data_node = ElementTree.SubElement(app_node, 'meta-data')
@@ -81,7 +79,7 @@ def main():
options = _ParseArgs()
with open(options.src_manifest) as f:
main_manifest_data = f.read()
- new_manifest_data = _ProcessManifest(main_manifest_data, options.src_manifest,
+ new_manifest_data = _ProcessManifest(main_manifest_data,
options.disable_isolated_processes)
with open(options.out_manifest, 'w') as f:
f.write(new_manifest_data)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698