summaryrefslogtreecommitdiff
path: root/wallet
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2024-01-15 09:41:01 -0300
committerTorsten Grote <t@grobox.de>2024-01-15 09:41:01 -0300
commit6eaa1b8f75cb0cb2c7813fd3786f042f0823d56f (patch)
tree3e908b67fcb91ae955e0d454ab4eea8617b0c22c /wallet
parent0f32834dbbea6737793a7b55190ab58fdfa0bc3d (diff)
downloadtaler-android-6eaa1b8f75cb0cb2c7813fd3786f042f0823d56f.tar.gz
taler-android-6eaa1b8f75cb0cb2c7813fd3786f042f0823d56f.tar.bz2
taler-android-6eaa1b8f75cb0cb2c7813fd3786f042f0823d56f.zip
[wallet] add option to create ABI split APKs
Diffstat (limited to 'wallet')
-rw-r--r--wallet/build.gradle28
1 files changed, 28 insertions, 0 deletions
diff --git a/wallet/build.gradle b/wallet/build.gradle
index 23c8a0b..cde5efd 100644
--- a/wallet/build.gradle
+++ b/wallet/build.gradle
@@ -60,6 +60,8 @@ android {
fdroid {
dimension "distributionChannel"
applicationIdSuffix ".fdroid"
+ // version codes get multiplied by 10 and an ABI suffix gets added to the code
+ // if 'splitApk' property is set
}
google {
dimension "distributionChannel"
@@ -101,6 +103,15 @@ android {
excludes += ['META-INF/*.kotlin_module']
}
}
+ splits {
+ abi {
+ // can not be defined per flavor, so we use a property to turn this on for F-Droid
+ enable project.hasProperty('splitApk')
+ reset() // Resets the list of ABIs to remove all included by default
+ include "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
+ universalApk false
+ }
+ }
lint {
abortOnError true
@@ -167,3 +178,20 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
}
}
+
+// Map for the version code that gives each ABI a value.
+ext.abiCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2, x86: 3, x86_64: 4]
+// For each APK output variant, override versionCode with a combination of ext.abiCodes + variant.versionCode.
+android.applicationVariants.configureEach { variant ->
+ // Assigns a different version code for each output APK
+ variant.outputs.each { output ->
+ // Stores the value of ext.abiCodes that is associated with the ABI for this variant.
+ def baseAbiVersionCode =
+ // Determines the ABI for this variant and returns the mapped value.
+ project.ext.abiCodes.get(output.getFilter(com.android.build.OutputFile.ABI))
+ if (baseAbiVersionCode != null) {
+ output.versionCodeOverride = 10 * variant.versionCode + baseAbiVersionCode
+ }
+ // leaves version code alone of there's no baseAbiVersionCode
+ }
+}