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 java.io.FileInputStream
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
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 = "documents-$versionCode"
archivesName = "documents-$baseVersionCode"
}

android {
Expand All @@ -36,7 +40,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
}

signingConfigs {
Expand Down Expand Up @@ -93,6 +97,15 @@ android {
register("gplay")
}

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

compileOptions {
val currentJavaVersionFromLibs = JavaVersion.valueOf(libs.versions.app.build.javaVersion.get())
sourceCompatibility = currentJavaVersionFromLibs
Expand Down Expand Up @@ -128,6 +141,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("documents-$versionCode-foss${abiSuffix}-release${unsignedSuffix}.apk")
}
}
}
}

detekt {
config.setFrom("$rootDir/detekt.yml")
buildUponDefaultConfig = true
Expand Down
Loading