Require explicit ordering of groups in the configuration file to ensure
that the correct version code is set. Ordering based on a single ABI is
straight forward to ensure Play Store delivers the correct APK, but when
an APK needs more than one ABI things get messy quickly. This also goes
for screen density etc. The only thing that is easily sorted without
this attribute is android-sdk since an artifact can only reference a
single SDK.
Test: unit tests
Test: manually split an APK with update config.xml
Change-Id: I37a2b8b8a8409d6d6ff27c7142d4c8c8065a7a51
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
Implement the todo left from last change to read the contents of the
configuration file from disk. Since this is an operation that may fail
the API was changed to take return a Maybe to indicate errors reading
the file.
Test: unit test for error condition
Test: ran aapt2 optimize with the new code path wired in
Change-Id: I93d532b4a57af9520231225eee4fc5f2b1a046b9
The current iteration of the schema allows for both Split and Optimize
commands running off the same file. A split command is multiple optimize
command, and an optimize is a split with only a single artifact. To
combine the two, a single file with one or more artifacts can be passed
to either command. If multiple artifiacts are used for an optimize
command, the required artifact can be specified on the command line. A
configuration with only a single artifact can be used with either
command to get the same result.
Change-Id: Ie48eda6e2f9f8bf25d75ef7bcc3b3401a2d3e8eb
Bugs: 37847908
Test: xmllint --noout --schema aapt2.xsd example/config.xml