feat: enhance versioning and avatar handling with dynamic properties and improved UI interactions

This commit is contained in:
k1ngsterr1
2026-02-10 20:41:32 +05:00
parent bbaa04cda5
commit a0ef378909
12 changed files with 401 additions and 99 deletions

View File

@@ -5,6 +5,20 @@ plugins {
id("com.google.gms.google-services")
}
fun safeGitOutput(vararg args: String): String? {
return runCatching {
providers.exec { commandLine("git", *args) }.standardOutput.asText.get().trim().ifBlank { null }
}.getOrNull()
}
val versionBase = providers.gradleProperty("ROSETTA_VERSION_BASE").orElse("1.0")
val explicitVersionCode = providers.gradleProperty("ROSETTA_VERSION_CODE").orNull?.toIntOrNull()
val explicitVersionName = providers.gradleProperty("ROSETTA_VERSION_NAME").orNull
val gitCommitCount = safeGitOutput("rev-list", "--count", "HEAD")?.toIntOrNull()
val gitShortSha = safeGitOutput("rev-parse", "--short", "HEAD") ?: "unknown"
val computedVersionCode = (explicitVersionCode ?: gitCommitCount ?: 1).coerceAtLeast(1)
val computedVersionName = explicitVersionName ?: "${versionBase.get()}.$computedVersionCode"
android {
namespace = "com.rosetta.messenger"
compileSdk = 34
@@ -13,8 +27,9 @@ android {
applicationId = "com.rosetta.messenger"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"
versionCode = computedVersionCode
versionName = computedVersionName
buildConfigField("String", "GIT_SHA", "\"$gitShortSha\"")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables { useSupportLibrary = true }
@@ -52,7 +67,10 @@ android {
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions { jvmTarget = "11" }
buildFeatures { compose = true }
buildFeatures {
compose = true
buildConfig = true
}
composeOptions { kotlinCompilerExtensionVersion = "1.5.4" }
packaging {
resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" }