Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/prepare-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ on:
jobs:
call-release-pr:
uses: FossifyOrg/.github/.github/workflows/prepare-release-pr.yml@main
with:
abi_apks: true
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
name: Release
uses: FossifyOrg/.github/.github/workflows/release.yml@main
with:
abi_apks: true
track: ${{ vars.GPLAY_TRACK || 'beta' }}
rollout: ${{ vars.GPLAY_ROLLOUT || '0.05' }}
validate_only: ${{ vars.GPLAY_DRY_RUN == 'true' }}
Expand Down
37 changes: 34 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import com.android.build.api.variant.FilterConfiguration
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.konan.properties.Properties
Expand All @@ -22,9 +23,12 @@ fun hasSigningVars(): Boolean {
&& providers.environmentVariable("SIGNING_STORE_PASSWORD").orNull != null
}

val baseVersionCode = project.property("VERSION_CODE").toString().toInt()
val abiCodes = mapOf("armeabi-v7a" to 1, "arm64-v8a" to 2, "x86" to 3, "x86_64" to 4)
val abiSplits = providers.gradleProperty("ABI_SPLITS").map(String::toBoolean).getOrElse(false)

base {
val versionCode = project.property("VERSION_CODE").toString().toInt()
archivesName = "keyboard-$versionCode"
archivesName = "keyboard-$baseVersionCode"
}

android {
Expand All @@ -35,7 +39,7 @@ android {
minSdk = project.libs.versions.app.build.minimumSDK.get().toInt()
targetSdk = project.libs.versions.app.build.targetSDK.get().toInt()
versionName = project.property("VERSION_NAME").toString()
versionCode = project.property("VERSION_CODE").toString().toInt()
versionCode = baseVersionCode
multiDexEnabled = true
vectorDrawables.useSupportLibrary = true
ksp {
Expand Down Expand Up @@ -91,6 +95,15 @@ android {
register("gplay")
}

splits {
abi {
isEnable = abiSplits
reset()
include(*abiCodes.keys.toTypedArray())
isUniversalApk = true
}
}

sourceSets {
getByName("main").java.directories.add("src/main/kotlin")
}
Expand Down Expand Up @@ -133,6 +146,24 @@ android {
}
}

if (abiSplits) {
androidComponents {
onVariants(selector().withBuildType("release").withFlavor("variants" to "foss")) { variant ->
variant.outputs.forEach { output ->
val abi = output.filters.find {
it.filterType == FilterConfiguration.FilterType.ABI
}?.identifier
val versionCode = baseVersionCode + (abiCodes[abi] ?: 0)
val abiSuffix = abi?.let { "-$it" }.orEmpty()
val unsignedSuffix =
if (output.outputFileName.get().endsWith("-unsigned.apk")) "-unsigned" else ""
output.versionCode.set(versionCode)
output.outputFileName.set("keyboard-$versionCode-foss${abiSuffix}-release${unsignedSuffix}.apk")
}
}
}
}

detekt {
baseline = file("detekt-baseline.xml")
config.setFrom("$rootDir/detekt.yml")
Expand Down
Loading