[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-android] 01/02: [wallet] add option to create ABI split APK
From: |
gnunet |
Subject: |
[taler-taler-android] 01/02: [wallet] add option to create ABI split APKs |
Date: |
Mon, 15 Jan 2024 14:07:21 +0100 |
This is an automated email from the git hooks/post-receive script.
torsten-grote pushed a commit to branch master
in repository taler-android.
commit 6eaa1b8f75cb0cb2c7813fd3786f042f0823d56f
Author: Torsten Grote <t@grobox.de>
AuthorDate: Mon Jan 15 09:41:01 2024 -0300
[wallet] add option to create ABI split APKs
---
wallet/build.gradle | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
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
+ }
+}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.