Shane Farmer 78c43d7bee AAPT2: Sort artifacts based on the Play Store rules.
Sort output artifacts so that the updated versionCode manifest entry
will allow correct handling of updates from Play Store. The most
important dimension is Android SDK version. It is important that a split
based on min SDK version will allow a user to get a new APK if they
upgrade the OS on their device to support a new split.

ABI splits need to also be taken into consideration as it is possible
for a device to run in ARM emulation mode and installing an ARM APK over
a x86 APK could cause performance regressions.

The XML file format was updated to give each of the configuration groups
have their own section of the XML file. This allows the sort order to be
determined by a groups ordering. Artifacts can now be added to the
configuration file in an arbitrary order. Since this will be the common
case for developers, it will help reduce errors from inserting a new
artifact in the wrong spot.

The implementation follows the rules outlined at:
https://developer.android.com/google/play/publishing/multiple-apks.html

Test: Unit tests
Test: Manual process XML configuration

Change-Id: I0face862c6d6b9d3cd2d99088afe5b9491be0120
2017-12-19 13:52:30 -08:00

170 lines
5.9 KiB
XML

<?xml version="1.0" encoding="utf-8" ?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
xmlns="http://schemas.android.com/tools/aapt2"
targetNamespace="http://schemas.android.com/tools/aapt2">
<xsd:element name="post-process">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="artifacts" type="artifacts"/>
<xsd:element name="android-sdks" type="android-sdks"/>
<xsd:element name="abi-groups" type="abi-groups"/>
<xsd:element name="screen-density-groups" type="screen-density-groups"/>
<xsd:element name="locale-groups" type="locale-groups"/>
<xsd:element name="gl-texture-groups" type="gl-texture-groups"/>
<xsd:element name="device-feature-groups" type="device-feature-groups"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="android-sdks">
<xsd:sequence>
<xsd:element name="android-sdk" type="android-sdk" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="abi-groups">
<xsd:sequence>
<xsd:element name="abi-group" type="abi-group" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="screen-density-groups">
<xsd:sequence>
<xsd:element name="screen-density-group" type="screen-density-group" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="locale-groups">
<xsd:sequence>
<xsd:element name="locale-group" type="locale-group" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="gl-texture-groups">
<xsd:sequence>
<xsd:element
name="gl-texture-group"
type="gl-texture-group"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="device-feature-groups">
<xsd:sequence>
<xsd:element name="device-feature-group" type="device-feature-group" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="artifacts">
<xsd:sequence>
<xsd:element name="artifact-format" type="xsd:string"/>
<xsd:element name="artifact" type="artifact" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="generate-all" type="xsd:boolean"/>
</xsd:complexType>
<!-- Groups output artifacts together by dimension labels. -->
<xsd:complexType name="artifact">
<xsd:attribute name="abi-group" type="xsd:string"/>
<xsd:attribute name="android-sdk-group" type="xsd:string"/>
<xsd:attribute name="device-feature-group" type="xsd:string"/>
<xsd:attribute name="gl-texture-group" type="xsd:string"/>
<xsd:attribute name="screen-density-group" type="xsd:string"/>
<xsd:attribute name="locale-group" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="gl-texture-group">
<xsd:sequence>
<xsd:element name="gl-texture" type="gl-texture" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="label" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="gl-texture">
<xsd:sequence>
<xsd:element name="texture-path" type="xsd:string" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="device-feature-group">
<xsd:sequence>
<xsd:element name="supports-feature" type="xsd:string" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="label" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="abi-group">
<xsd:sequence>
<xsd:element name="abi" type="abi-name" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="label" type="xsd:string"/>
</xsd:complexType>
<xsd:simpleType name="abi-name">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="armeabi"/>
<xsd:enumeration value="armeabi-v7a"/>
<xsd:enumeration value="arm64-v8a"/>
<xsd:enumeration value="x86"/>
<xsd:enumeration value="x86_64"/>
<xsd:enumeration value="mips"/>
<xsd:enumeration value="mips64"/>
<xsd:enumeration value="fat"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="screen-density-group">
<xsd:sequence>
<xsd:element name="screen-density" type="screen-density" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="label" type="xsd:string"/>
</xsd:complexType>
<xsd:simpleType name="screen-density">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="alldpi"/>
<xsd:enumeration value="ldpi"/>
<xsd:enumeration value="mdpi"/>
<xsd:enumeration value="hdpi"/>
<xsd:enumeration value="xhdpi"/>
<xsd:enumeration value="xxhdpi"/>
<xsd:enumeration value="xxxhdpi"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="android-sdk">
<!-- TODO(safarmer): Add permissions to add/remove. -->
<!-- TODO(safarmer): Add option for uncompressed native libs. -->
<xsd:sequence>
<xsd:element name="manifest" type="manifest"/>
</xsd:sequence>
<xsd:attribute name="label" type="xsd:string" use="required"/>
<xsd:attribute name="minSdkVersion" type="xsd:integer" use="required"/>
<xsd:attribute name="targetSdkVersion" type="xsd:integer"/>
<xsd:attribute name="maxSdkVersion" type="xsd:integer"/>
</xsd:complexType>
<!-- TODO(safarmer): Figure out the best way to handle manifest updates. -->
<xsd:simpleType name="manifest">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:complexType name="locale-group">
<xsd:sequence>
<xsd:element name="locale" type="locale" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="label" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="locale">
<xsd:attribute name="lang" type="xsd:string"/>
<xsd:attribute name="region" type="xsd:string"/>
<xsd:attribute name="compressed" type="xsd:boolean"/>
</xsd:complexType>
</xsd:schema>