diff --git a/app/build.gradle.kts b/app/build.gradle.kts index fbcf239..078de56 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -26,8 +26,8 @@ android { applicationId = "com.pixelized.rplexicon" minSdk = 26 targetSdk = 33 - versionCode = 3 - versionName = "0.1.2" + versionCode = gitBuildNumber + versionName = "0.1.3" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { @@ -126,4 +126,13 @@ dependencies { kapt("com.github.bumptech.glide:compiler:4.14.2") // this have to be align with landscapist-glide } -private val NamedDomainObjectContainer.pixelized get() = this.getByName("pixelized") \ No newline at end of file +private val NamedDomainObjectContainer.pixelized get() = this.getByName("pixelized") + +val gitBuildNumber: Int get() { + val stdout = org.apache.commons.io.output.ByteArrayOutputStream() + rootProject.exec { + commandLine("git", "rev-list", "--count", "HEAD") + standardOutput = stdout + } + return stdout.toString().trim().toInt() +} \ No newline at end of file