/** * Synthetic Android App Bundles for the release tests (android-release, android-sign-upload): MAKE_AAB is a Python * program, `python3 make_aab.py `, writing a zip whose base manifest is aapt2's * protobuf XmlNode, as scripts/lib/aab_manifest.py reads a real bundle's. */ export const MAKE_AAB = `import sys, zipfile def varint(n): out = b"" while True: b = n & 0x7F; n >>= 7 if n: out += bytes([b | 0x80]) else: return out + bytes([b]) def field(number, data): return varint((number << 3) | 2) + varint(len(data)) + data def attribute(name, value): return field(4, field(1, b"http://schemas.android.com/apk/res/android" if name != "package" else b"") + field(2, name.encode()) + field(3, value.encode())) out, package, code = sys.argv[1:4] element = field(3, b"manifest") + attribute("versionCode", code) + attribute("versionName", "1.0.0") + attribute("package", package) with zipfile.ZipFile(out, "w") as z: z.writestr("base/manifest/AndroidManifest.xml", field(1, element)) z.writestr("base/dex/classes.dex", "synthetic " + package) `;