Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class GravatarAndroidApplicationConventionPlugin : Plugin<Project> {
defaultConfig.apply {
applicationId = APP_ID
targetSdk = TARGET_SDK
versionCode = 1
versionName = "1.0"
versionCode = project.property("versionCode") as Int
versionName = project.property("versionName") as String
}
buildFeatures.buildConfig = true
configureBuildTypes()
Expand Down
23 changes: 23 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.util.Properties

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
Expand All @@ -10,3 +12,24 @@ plugins {
alias(libs.plugins.ksp) apply false
alias(libs.plugins.room) apply false
}

val versionProperties = loadPropertiesFromFile(file("version.properties"))

project.apply {
extra.apply {
set("versionName", versionProperties.getProperty("versionName", null))
set("versionCode", versionProperties.getProperty("versionCode", null).toInt())
set("isCi", System.getenv("CI")?.toBoolean() ?: false)
}
}

fun loadPropertiesFromFile(inputFile: File): Properties {
val properties = Properties()
if (!inputFile.exists()) {
return properties
}
inputFile.inputStream().use { stream ->
properties.load(stream)
}
return properties
}
2 changes: 2 additions & 0 deletions version.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
versionName=0.1
versionCode=3