Skip to content

Commit e15ab96

Browse files
committed
refactor: simplify build setup
1 parent 38ba812 commit e15ab96

File tree

2 files changed

+17
-35
lines changed

2 files changed

+17
-35
lines changed

.github/workflows/build-apk.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ jobs:
6363
./gradlew assembleGithubRelease
6464
mv app/build/outputs/apk/githubRelease/*.apk .
6565
elif [ "$BUILD_TYPE" = "staging" ]; then
66-
./gradlew assembleStaging
67-
mv app/build/outputs/apk/staging/*.apk .
66+
./gradlew assembleDebug
67+
mv app/build/outputs/apk/debug/*-arm64*.apk .
6868
elif [ "$BUILD_TYPE" = "debug" ]; then
6969
./gradlew assembleDebug
7070
mv app/build/outputs/apk/debug/*.apk .

app/build.gradle.kts

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ android {
5757
}
5858
}
5959

60+
splits {
61+
abi {
62+
isEnable = true
63+
isUniversalApk = true
64+
65+
reset()
66+
include("arm64-v8a", "armeabi-v7a", "x86_64", "x86")
67+
}
68+
}
69+
6070
buildTypes {
6171
release {
6272
isMinifyEnabled = true
@@ -66,38 +76,11 @@ android {
6676
getDefaultProguardFile("proguard-android-optimize.txt"),
6777
"proguard-rules.pro"
6878
)
69-
70-
splits {
71-
abi {
72-
isEnable = true
73-
reset()
74-
include("arm64-v8a", "armeabi-v7a", "x86_64", "x86")
75-
}
76-
}
7779
}
7880

7981
create("githubRelease") {
8082
initWith(getByName("release"))
81-
signingConfig = signingConfigs.getByName("release")
82-
83-
splits {
84-
abi {
85-
isUniversalApk = true
86-
}
87-
}
88-
}
89-
90-
create("staging") {
91-
initWith(getByName("debug"))
92-
93-
ndk {
94-
splits {
95-
abi {
96-
isEnable = false
97-
}
98-
}
99-
abiFilters.add("arm64-v8a")
100-
}
83+
// signingConfig = signingConfigs.getByName("release")
10184
}
10285
}
10386

@@ -134,15 +117,14 @@ android {
134117
// rename the output APK file
135118
outputs.configureEach {
136119
val isRelease = buildType.name.lowercase().contains("release")
137-
val abiName = "-" + if (filters.any { it.filterType == "ABI" }) {
138-
filters.find { it.filterType == "ABI" }?.identifier ?: "universal"
139-
} else "universal"
140-
val abiSuffix = if (isRelease) abiName else ""
120+
val abiName = if (filters.any { it.filterType == "ABI" }) {
121+
"-" + filters.find { it.filterType == "ABI" }?.identifier
122+
} else ""
141123
(this as ApkVariantOutputImpl).outputFileName =
142124
"${rootProject.name.lowercase()}${
143125
if (isRelease) "-"
144126
else "-${buildType.name}-"
145-
}${defaultConfig.versionName}$abiSuffix.apk"
127+
}${defaultConfig.versionName}$abiName.apk"
146128
}
147129
}
148130
}

0 commit comments

Comments
 (0)