Skip to content

Commit

Permalink
Calculate versionCode
Browse files Browse the repository at this point in the history
  • Loading branch information
damontecres committed Jan 4, 2024
1 parent 283058e commit d883669
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ plugins {
id("com.apollographql.apollo3") version "3.8.2"
}


fun getVersionCode(): Int {
val stdout = ByteArrayOutputStream()
exec {
commandLine = listOf("git", "tag", "--list", "v*")
standardOutput = stdout
}
return stdout.toString().trim().lines().size
}

fun getAppVersion(): String {
val stdout = ByteArrayOutputStream()
exec {
Expand All @@ -24,7 +34,7 @@ android {
applicationId = "com.github.damontecres.stashapp"
minSdk = 23
targetSdk = 34
versionCode = 2
versionCode = getVersionCode()
versionName = getAppVersion()
}

Expand Down

0 comments on commit d883669

Please sign in to comment.