Skip to content

Commit 10e31ab

Browse files
committed
feat: Switch to semantic versioning (#5)
Signed-off-by: Saalim Quadri <danascape@gmail.com>
1 parent d330b2b commit 10e31ab

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

app/build.gradle.kts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ plugins {
44
alias(libs.plugins.kotlin.compose)
55
}
66

7+
val versionMajor: Int by rootProject.extra
8+
val versionMinor: Int by rootProject.extra
9+
val versionPatch: Int by rootProject.extra
10+
val computedVersionCode: Int by rootProject.extra
11+
val computedVersionName: String by rootProject.extra
12+
713
android {
814
namespace = "org.prauga.pvotcalculator"
915
compileSdk {
@@ -14,12 +20,21 @@ android {
1420
applicationId = "org.prauga.pvotcalculator"
1521
minSdk = 30
1622
targetSdk = 36
17-
versionCode = 1
18-
versionName = "1.0"
23+
versionCode = computedVersionCode
24+
versionName = computedVersionName
25+
26+
buildConfigField("int", "VERSION_MAJOR", "$versionMajor")
27+
buildConfigField("int", "VERSION_MINOR", "$versionMinor")
28+
buildConfigField("int", "VERSION_PATCH", "$versionPatch")
29+
1930

2031
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2132
}
2233

34+
extensions.getByType(BasePluginExtension::class.java)
35+
.archivesName
36+
.set("PvotCalculator-v${defaultConfig.versionName}")
37+
2338
buildTypes {
2439
release {
2540
isMinifyEnabled = true
@@ -39,6 +54,7 @@ android {
3954
}
4055
buildFeatures {
4156
compose = true
57+
buildConfig = true
4258
}
4359
}
4460

build.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,16 @@ plugins {
33
alias(libs.plugins.android.application) apply false
44
alias(libs.plugins.kotlin.android) apply false
55
alias(libs.plugins.kotlin.compose) apply false
6+
}
7+
8+
ext {
9+
val versionMajor = 1
10+
val versionMinor = 0
11+
val versionPatch = 0
12+
13+
set("versionMajor", versionMajor)
14+
set("versionMinor", versionMinor)
15+
set("versionPatch", versionPatch)
16+
set("computedVersionCode", versionMajor * 10000 + versionMinor * 100 + versionPatch)
17+
set("computedVersionName", "$versionMajor.$versionMinor.$versionPatch")
618
}

0 commit comments

Comments
 (0)