Fix build_split_manifest.py to not include the versionCode or versionName
attributes if they aren't present in the original manifest. Before, it would make them None, and aapt would fail.
--
PiperOrigin-RevId: 145726642
MOS_MIGRATED_REVID=145726642
diff --git a/tools/android/build_split_manifest_test.py b/tools/android/build_split_manifest_test.py
index 5cfe980..a744b97 100644
--- a/tools/android/build_split_manifest_test.py
+++ b/tools/android/build_split_manifest_test.py
@@ -29,6 +29,13 @@
</manifest>
"""
+NO_VERSION_MANIFEST = """
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.google.package" >
+</manifest>
+"""
+
class BuildSplitManifestTest(unittest.TestCase):
@@ -49,6 +56,12 @@
manifest = ElementTree.fromstring(split)
self.assertEqual("my.little.splony", manifest.get("split"))
+ def testManifestWithNoVersion(self):
+ split = BuildSplitManifest(NO_VERSION_MANIFEST, None, "split", False)
+ manifest = ElementTree.fromstring(split)
+ self.assertEqual(None, manifest.get("android:versionCode"))
+ self.assertEqual(None, manifest.get("android:versionName"))
+
if __name__ == "__main__":
unittest.main()