Skip to content

Commit

Permalink
Merge pull request #3540 from kiwix/move_version_from_both_gradles
Browse files Browse the repository at this point in the history
Moved version-related properties from individual build.gradle files to a common configuration file (`Config.kt`).
  • Loading branch information
kelson42 authored Nov 21, 2023
2 parents 72197c2 + 52fefe7 commit 527e270
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
14 changes: 4 additions & 10 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@ plugins.apply(KiwixConfigurationPlugin::class)

apply(from = rootProject.file("jacoco.gradle"))

ext {
set("versionMajor", 3)
set("versionMinor", 7)
set("versionPatch", 1)
}

fun generateVersionName() = "${ext["versionMajor"]}.${ext["versionMinor"]}.${ext["versionPatch"]}"
fun generateVersionName() = "${Config.versionMajor}.${Config.versionMinor}.${Config.versionPatch}"

/*
* max version code: 21-0-0-00-00-00
Expand All @@ -30,9 +24,9 @@ fun generateVersionName() = "${ext["versionMajor"]}.${ext["versionMinor"]}.${ext

fun generateVersionCode() =
20 * 10000 +
ext["versionMajor"] as Int * 10000 +
ext["versionMinor"] as Int * 100 +
ext["versionPatch"] as Int
Config.versionMajor * 10000 +
Config.versionMinor * 100 +
Config.versionPatch

val apkPrefix get() = System.getenv("TAG") ?: "kiwix"

Expand Down
5 changes: 5 additions & 0 deletions buildSrc/src/main/kotlin/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@ object Config {
const val targetSdk = 33 // Target SDK (Maximum Support Device) is 33 (Android 13).

val javaVersion = JavaVersion.VERSION_1_8

// Version Information
const val versionMajor = 3 // Major version component of the app's version name and version code.
const val versionMinor = 8 // Minor version component of the app's version name and version code.
const val versionPatch = 0 // Patch version component of the app's version name and version code.
}
11 changes: 3 additions & 8 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ plugins {
plugins.apply(KiwixConfigurationPlugin::class)
apply(plugin = "io.objectbox")
apply(plugin = "com.jakewharton.butterknife")
ext {
set("versionMajor", 3)
set("versionMinor", 8)
set("versionPatch", 0)
}

/*
* max version code: 21-0-0-00-00-00
Expand All @@ -38,9 +33,9 @@ ext {

fun generateVersionCode() =
20 * 10000 +
ext["versionMajor"] as Int * 10000 +
ext["versionMinor"] as Int * 100 +
ext["versionPatch"] as Int
Config.versionMajor * 10000 +
Config.versionMinor * 100 +
Config.versionPatch

android {
defaultConfig {
Expand Down

0 comments on commit 527e270

Please sign in to comment.