From 74316f17d6f35cfb650ee84d532079fa2da6038b Mon Sep 17 00:00:00 2001 From: Amir Khodak Date: Fri, 22 May 2026 20:27:43 +0000 Subject: [PATCH] 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 --- app/build.gradle.kts | 10 ++++++++-- .../kotlin/com/syncflow/ui/settings/SettingsScreen.kt | 2 +- version.properties | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 version.properties diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a0fcd6c..869e17f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -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 diff --git a/app/src/main/kotlin/com/syncflow/ui/settings/SettingsScreen.kt b/app/src/main/kotlin/com/syncflow/ui/settings/SettingsScreen.kt index a8da50d..6aeb8dc 100644 --- a/app/src/main/kotlin/com/syncflow/ui/settings/SettingsScreen.kt +++ b/app/src/main/kotlin/com/syncflow/ui/settings/SettingsScreen.kt @@ -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) } } diff --git a/version.properties b/version.properties new file mode 100644 index 0000000..478eaea --- /dev/null +++ b/version.properties @@ -0,0 +1,2 @@ +VERSION_NAME=1.0.0 +VERSION_CODE=1