Add version.properties and read version in build.gradle
Single source of truth: bump VERSION_NAME/VERSION_CODE in version.properties to release a new version. BuildConfig.VERSION_NAME exposed to the app. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.kotlin.android)
|
||||
@@ -7,6 +9,10 @@ plugins {
|
||||
alias(libs.plugins.ksp)
|
||||
}
|
||||
|
||||
val versionProps = Properties().apply {
|
||||
load(rootProject.file("version.properties").inputStream())
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.syncflow"
|
||||
compileSdk = 34
|
||||
@@ -15,8 +21,8 @@ android {
|
||||
applicationId = "com.syncflow"
|
||||
minSdk = 26
|
||||
targetSdk = 35
|
||||
versionCode = 1
|
||||
versionName = "1.0.0"
|
||||
versionCode = versionProps["VERSION_CODE"].toString().toInt()
|
||||
versionName = versionProps["VERSION_NAME"].toString()
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
// Placeholder — replace with real keys before release
|
||||
|
||||
@@ -103,7 +103,7 @@ fun SettingsScreen(
|
||||
Spacer(Modifier.height(16.dp))
|
||||
Text("About", style = MaterialTheme.typography.titleMedium)
|
||||
HorizontalDivider(modifier = Modifier.padding(vertical = 4.dp))
|
||||
Text("SyncFlow v1.0.0 — Free, no subscription.", style = MaterialTheme.typography.bodySmall)
|
||||
Text("SyncFlow v${com.syncflow.BuildConfig.VERSION_NAME} — Free, no subscription.", style = MaterialTheme.typography.bodySmall)
|
||||
Text("Open source. No ads. No tracking.", style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
VERSION_NAME=1.0.0
|
||||
VERSION_CODE=1
|
||||
Reference in New Issue
Block a user