summaryrefslogtreecommitdiff
path: root/scripts/manifest_check.py
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2024-09-11 13:28:16 -0700
committer Colin Cross <ccross@android.com> 2024-09-13 11:20:21 -0700
commite1ab849b391c6d5c7fbf57310701c99cad88ba21 (patch)
tree558714e1e6952e7c6509e36b5d259e153b655c52 /scripts/manifest_check.py
parent6cb462b38c07507e0fc1518762ac2b579a3ede8c (diff)
Support multiple <application> or <uses-sdk> elements in manifest_*.py
Manifests may now have multiple copies of elements if they are disambiguated with android:featureFlag attributes. Remove the restrictions on duplicate elements from manifest_check.py and manifest_fixer.py, and instead iterate over all matching elements. Test: manifest_check_test.py, manifest_fixer_test.py Bug: 365170653 Flag: EXEMPT bugfix Change-Id: Ib577439d03a808a20a5fcc3e15a3117e0970d729
Diffstat (limited to 'scripts/manifest_check.py')
-rwxr-xr-xscripts/manifest_check.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/scripts/manifest_check.py b/scripts/manifest_check.py
index c48c9f992..1e32d1d7d 100755
--- a/scripts/manifest_check.py
+++ b/scripts/manifest_check.py
@@ -25,10 +25,7 @@ import subprocess
import sys
from xml.dom import minidom
-from manifest import android_ns
-from manifest import get_children_with_tag
-from manifest import parse_manifest
-from manifest import write_xml
+from manifest import *
class ManifestMismatchError(Exception):
@@ -205,15 +202,9 @@ def extract_uses_libs_xml(xml):
"""Extract <uses-library> tags from the manifest."""
manifest = parse_manifest(xml)
- elems = get_children_with_tag(manifest, 'application')
- if len(elems) > 1:
- raise RuntimeError('found multiple <application> tags')
- if not elems:
- return [], [], []
-
- application = elems[0]
-
- libs = get_children_with_tag(application, 'uses-library')
+ libs = [child
+ for application in get_or_create_applications(xml, manifest)
+ for child in get_children_with_tag(application, 'uses-library')]
required = [uses_library_name(x) for x in libs if uses_library_required(x)]
optional = [