Fix/splits (#4626)

This commit is contained in:
James Rich 2026-02-22 08:48:04 -06:00 committed by GitHub
parent 9524fecca5
commit 96adc70401
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -128,10 +128,15 @@ configure<ApplicationExtension> {
}
ndk { abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64") }
val disableSplits =
project.gradle.startParameter.taskNames.any {
it.contains("bundle", ignoreCase = true) || it.contains("google", ignoreCase = true)
}
// Enable ABI splits to generate smaller APKs per architecture for F-Droid/IzzyOnDroid
splits {
abi {
isEnable = true
isEnable = !disableSplits
reset()
include("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
isUniversalApk = true
@ -151,11 +156,12 @@ configure<ApplicationExtension> {
// Configure existing product flavors (defined by convention plugin)
// with their dynamic version names.
productFlavors {
named("google") {
versionName = "${defaultConfig.versionName} (${defaultConfig.versionCode}) google"
manifestPlaceholders["MAPS_API_KEY"] = "dummy"
configureEach {
versionName = "${defaultConfig.versionName} (${defaultConfig.versionCode}) $name"
if (name == "google") {
manifestPlaceholders["MAPS_API_KEY"] = "dummy"
}
}
named("fdroid") { versionName = "${defaultConfig.versionName} (${defaultConfig.versionCode}) fdroid" }
}
buildTypes {
@ -181,15 +187,12 @@ secrets {
}
androidComponents {
onVariants(selector().all()) { variant ->
if (variant.name == "fdroidDebug") {
variant.applicationId = "com.geeksville.mesh.fdroid.debug"
}
if (variant.name == "googleDebug") {
variant.applicationId = "com.geeksville.mesh.google.debug"
onVariants(selector().withBuildType("debug")) { variant ->
variant.flavorName?.let { flavor ->
variant.applicationId = "com.geeksville.mesh.$flavor.debug"
}
}
onVariants(selector().withBuildType("release")) { variant ->
if (variant.flavorName == "google") {
val variantNameCapped = variant.name.replaceFirstChar { it.uppercase() }