Skip to content

Commit

Permalink
Support split APKs for F-Droid
Browse files Browse the repository at this point in the history
versionCodes will be incremented from 0 (universal) to 4 (arm64-v8a) for each abi

Github release versionCode: 31008
F-Droid release versionCodes 310080-310084

Signed-off-by: IacobIonut01 <paulionut2003@gmail.com>
  • Loading branch information
IacobIonut01 committed Nov 16, 2024
1 parent b803aa6 commit b739704
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 23 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ jobs:
- uses: actions/download-artifact@v4
with:
name: Gallery Release (Maps)
- name: Remove apk release suffix
run: find . -name "Gallery-*.apk" -exec bash -c 'mv "$1" "${1//-release/}"' _ {} \;
- name: Generate SHA256
run: find . -name "Gallery-*.apk" -exec bash -c 'sha256sum "$1" | awk '\''{print $1}'\'' > "$1.sha256"' _ {} \;
- name: Create Release
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
chmod +x ./strip_allfiles_permission.sh && ./strip_allfiles_permission.sh &&
echo ALL_FILES_ACCESS=false > ./app.properties
- name: Build Google Play Bundle
run: ./gradlew bundleGplay
run: ./gradlew bundleUniversalGplay
env:
SIGNING_KEY_ALIAS: ${{ secrets.ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
Expand All @@ -111,15 +111,15 @@ jobs:
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: com.dot.gallery.gplay
releaseFiles: app/build/outputs/bundle/gplay/Gallery-${{ steps.versionname.outputs.versionName }}-${{ steps.versioncode.outputs.versionCode }}-gplay.aab
releaseFiles: app/build/outputs/bundle/universalGplay/Gallery-${{ steps.versionname.outputs.versionName }}-${{ steps.versioncode.outputs.versionCode }}-universal-gplay.aab
track: production
releaseName: ${{ steps.versionname.outputs.versionName }}-${{ steps.versioncode.outputs.versionCode }} Release
mappingFile: app/build/outputs/mapping/gplay/mapping.txt
debugSymbols: app/build/intermediates/merged_native_libs/gplay/mergeGplayNativeLibs/out/lib
mappingFile: app/build/outputs/mapping/universalGplay/mapping.txt
debugSymbols: app/build/intermediates/merged_native_libs/universalGplay/mergeUniversalGplayNativeLibs/out/lib
- uses: actions/upload-artifact@v4
with:
name: Gallery Release (GPlay Bundle)
path: app/build/outputs/bundle/gplay/Gallery-${{ steps.versionname.outputs.versionName }}-${{ steps.versioncode.outputs.versionCode }}-gplay.aab
path: app/build/outputs/bundle/universalGplay/Gallery-${{ steps.versionname.outputs.versionName }}-${{ steps.versioncode.outputs.versionCode }}-universal-gplay.aab

release:
needs: [build_nomaps, build_maps]
Expand All @@ -131,8 +131,6 @@ jobs:
- uses: actions/download-artifact@v4
with:
name: Gallery Release (Maps)
- name: Remove apk release suffix
run: find . -name "Gallery-*.apk" -exec bash -c 'mv "$1" "${1//-release/}"' _ {} \;
- name: Generate SHA256
run: find . -name "Gallery-*.apk" -exec bash -c 'sha256sum "$1" | awk '\''{print $1}'\'' > "$1.sha256"' _ {} \;
- name: Create Release
Expand Down
61 changes: 47 additions & 14 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import com.android.build.gradle.internal.api.BaseVariantOutputImpl
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeFeatureFlag
import java.io.FileInputStream
import java.util.Properties
Expand All @@ -22,17 +23,14 @@ android {
applicationId = "com.dot.gallery"
minSdk = 30
targetSdk = 35
versionCode = 31007
versionCode = 31008
versionName = "3.1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
base.archivesName.set("Gallery-${versionName}-$versionCode")
if (getApiKey() == "\"DEBUG\"") {
base.archivesName.set("${base.archivesName.get()}-nomaps")
}
base.archivesName.set("Gallery-${versionName}-$versionCode" + mapsApiApplicationPrefix)
}

lint.baseline = file("lint-baseline.xml")
Expand Down Expand Up @@ -119,19 +117,46 @@ android {
schemaDirectory("$projectDir/schemas/")
}

splits {
abi {
isEnable = true
reset()
include("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
isUniversalApk = true
}
}

dependenciesInfo {
// Disables dependency metadata when building APKs.
includeInApk = false
}

flavorDimensions += listOf("abi")
productFlavors {
create("arm64-v8a") {
dimension = "abi"
versionCode = 4 + (android.defaultConfig.versionCode ?: 0) * 10
ndk.abiFilters.add("arm64-v8a")
}
create("armeabi-v7a") {
dimension = "abi"
versionCode = 3 + (android.defaultConfig.versionCode ?: 0) * 10
ndk.abiFilters.add("armeabi-v7a")
}
create("x86_64") {
dimension = "abi"
versionCode = 2 + (android.defaultConfig.versionCode ?: 0) * 10
ndk.abiFilters.add("x86_64")
}
create("x86") {
dimension = "abi"
versionCode = 1 + (android.defaultConfig.versionCode ?: 0) * 10
ndk.abiFilters.add("x86")
}
create("universal") {
dimension = "abi"
versionCode = 0 + (android.defaultConfig.versionCode ?: 0) * 10
ndk.abiFilters.addAll(listOf("x86", "x86_64", "armeabi-v7a", "arm64-v8a"))
}
}

applicationVariants.all {
outputs.forEach { output ->
(output as BaseVariantOutputImpl).outputFileName =
"Gallery-${versionName}-$versionCode-${productFlavors[0].name}" + mapsApiApplicationPrefix + ".apk"
}
}
}

dependencies {
Expand Down Expand Up @@ -258,6 +283,14 @@ dependencies {
debugRuntimeOnly(libs.compose.ui.test.manifest)
}

val mapsApiApplicationPrefix: String
get() = if (getApiKey() == "\"DEBUG\"") {
"-nomaps"
} else {
""
}


fun getApiKey(): String {
val fl = rootProject.file("api.properties")

Expand Down
19 changes: 19 additions & 0 deletions baselineProfile/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@ android {
create("nonMinifiedStaging") {
}
}
flavorDimensions += listOf("abi")
productFlavors {
create("arm64-v8a") {
dimension = "abi"
ndk.abiFilters.add("arm64-v8a")
}
create("armeabi-v7a") {
dimension = "abi"
ndk.abiFilters.add("armeabi-v7a")
}
create("x86_64") {
dimension = "abi"
ndk.abiFilters.add("x86_64")
}
create("x86") {
dimension = "abi"
ndk.abiFilters.add("x86")
}
}
namespace = "com.dot.baselineprofile"
compileSdk = 34

Expand Down

0 comments on commit b739704

Please sign in to comment.