Skip to content

Commit

Permalink
fix versionCodeOverride for nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorch committed Oct 25, 2023
1 parent 175ba2c commit 53bc9cc
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id("de.mannodermaus.android-junit5")
}

fun getVersionCode(): Int {
fun getGitVersionCode(): Int {
return try {
val stdout = ByteArrayOutputStream()
exec {
Expand Down Expand Up @@ -86,15 +86,16 @@ android {

applicationVariants.all {
if (name == "nightly") {
outputs.all {
this as com.android.build.gradle.internal.api.ApkVariantOutputImpl
versionCodeOverride = getVersionCode()
versionNameOverride = "${applicationId}_${versionCode}"
outputs.forEach { output ->
output as com.android.build.gradle.internal.api.ApkVariantOutputImpl
output.versionCodeOverride = getGitVersionCode()
output.versionNameOverride = "${applicationId}_${output.versionCode}"
output.outputFileName = "${applicationId}_${versionCode}.apk"
}
}
outputs.all {
this as com.android.build.gradle.internal.api.ApkVariantOutputImpl
outputFileName = "${applicationId}_${versionCode}.apk"
outputs.forEach { output ->
output as com.android.build.gradle.internal.api.ApkVariantOutputImpl
output.outputFileName = "${applicationId}_${output.versionCode}.apk"
}
}

Expand Down

0 comments on commit 53bc9cc

Please sign in to comment.