summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/android/app/build.gradle.kts31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/android/app/build.gradle.kts b/src/android/app/build.gradle.kts
index 188ef9469..d44bb4c74 100644
--- a/src/android/app/build.gradle.kts
+++ b/src/android/app/build.gradle.kts
@@ -3,8 +3,8 @@
3 3
4import android.annotation.SuppressLint 4import android.annotation.SuppressLint
5import kotlin.collections.setOf 5import kotlin.collections.setOf
6import org.jetbrains.kotlin.konan.properties.Properties
7import org.jlleitschuh.gradle.ktlint.reporter.ReporterType 6import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
7import com.github.triplet.gradle.androidpublisher.ReleaseStatus
8 8
9plugins { 9plugins {
10 id("com.android.application") 10 id("com.android.application")
@@ -13,6 +13,7 @@ plugins {
13 kotlin("plugin.serialization") version "1.9.20" 13 kotlin("plugin.serialization") version "1.9.20"
14 id("androidx.navigation.safeargs.kotlin") 14 id("androidx.navigation.safeargs.kotlin")
15 id("org.jlleitschuh.gradle.ktlint") version "11.4.0" 15 id("org.jlleitschuh.gradle.ktlint") version "11.4.0"
16 id("com.github.triplet.play") version "3.8.6"
16} 17}
17 18
18/** 19/**
@@ -58,15 +59,7 @@ android {
58 targetSdk = 34 59 targetSdk = 34
59 versionName = getGitVersion() 60 versionName = getGitVersion()
60 61
61 // If you want to use autoVersion for the versionCode, create a property in local.properties 62 versionCode = if (System.getenv("AUTO_VERSIONED") == "true") {
62 // named "autoVersioned" and set it to "true"
63 val properties = Properties()
64 val versionProperty = try {
65 properties.load(project.rootProject.file("local.properties").inputStream())
66 properties.getProperty("autoVersioned") ?: ""
67 } catch (e: Exception) { "" }
68
69 versionCode = if (versionProperty == "true") {
70 autoVersion 63 autoVersion
71 } else { 64 } else {
72 1 65 1
@@ -221,6 +214,15 @@ ktlint {
221 } 214 }
222} 215}
223 216
217play {
218 val keyPath = System.getenv("SERVICE_ACCOUNT_KEY_PATH")
219 if (keyPath != null) {
220 serviceAccountCredentials.set(File(keyPath))
221 }
222 track.set(System.getenv("STORE_TRACK") ?: "internal")
223 releaseStatus.set(ReleaseStatus.COMPLETED)
224}
225
224dependencies { 226dependencies {
225 implementation("androidx.core:core-ktx:1.12.0") 227 implementation("androidx.core:core-ktx:1.12.0")
226 implementation("androidx.appcompat:appcompat:1.6.1") 228 implementation("androidx.appcompat:appcompat:1.6.1")
@@ -257,14 +259,13 @@ fun runGitCommand(command: List<String>): String {
257} 259}
258 260
259fun getGitVersion(): String { 261fun getGitVersion(): String {
262 val gitVersion = runGitCommand(listOf("git", "describe", "--always", "--long"))
260 val versionName = if (System.getenv("GITHUB_ACTIONS") != null) { 263 val versionName = if (System.getenv("GITHUB_ACTIONS") != null) {
261 val gitTag = System.getenv("GIT_TAG_NAME") ?: "" 264 System.getenv("GIT_TAG_NAME") ?: gitVersion
262 gitTag
263 } else { 265 } else {
264 runGitCommand(listOf("git", "describe", "--always", "--long")) 266 gitVersion
265 .replace(Regex("(-0)?-[^-]+$"), "")
266 } 267 }
267 return versionName.ifEmpty { "0.0" } 268 return versionName.replace(Regex("(-0)?-[^-]+$"), "").ifEmpty { "0.0" }
268} 269}
269 270
270fun getGitHash(): String = 271fun getGitHash(): String =