-
-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into update_icons
- Loading branch information
Showing
6 changed files
with
80 additions
and
81 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,79 @@ | ||
@file:Suppress("UnstableApiUsage") | ||
plugins { | ||
alias(libs.plugins.android.application) apply false | ||
alias(libs.plugins.android.library) apply false | ||
alias(libs.plugins.kotlin.android) apply false | ||
alias(libs.plugins.kotlin.serialization) apply false | ||
alias(libs.plugins.ksp) apply false | ||
alias(libs.plugins.compose.compiler) apply false | ||
alias(libs.plugins.room) apply false | ||
} | ||
|
||
buildscript { | ||
|
||
repositories { | ||
mavenCentral() | ||
google() | ||
} | ||
} | ||
|
||
@Suppress("DSL_SCOPE_VIOLATION") | ||
plugins { | ||
alias(libs.plugins.android.application) apply false | ||
alias(libs.plugins.android.library) apply false | ||
alias(libs.plugins.kotlin.android) apply false | ||
alias(libs.plugins.kotlin.serialization) apply false | ||
alias(libs.plugins.ksp) apply false | ||
alias(libs.plugins.compose.compiler) apply false | ||
sealed class Version( | ||
open val versionMajor: Int, | ||
val versionMinor: Int, | ||
val versionPatch: Int, | ||
val versionBuild: Int = 0 | ||
) { | ||
abstract fun toVersionName(): String | ||
|
||
fun toVersionCode(): Int { | ||
val minor = versionMinor.toString().padStart(2, '0') | ||
val patch = versionPatch.toString().padStart(2, '0') | ||
|
||
// Combining the version components, ensuring the result is 5 digits | ||
// We suppose that the major version won't be greater than 9 | ||
return "$versionMajor$minor$patch".toInt() | ||
} | ||
|
||
|
||
class Alpha(versionMajor: Int, versionMinor: Int, versionPatch: Int, versionBuild: Int) : | ||
Version(versionMajor, versionMinor, versionPatch, versionBuild) { | ||
override fun toVersionName(): String = | ||
"${versionMajor}.${versionMinor}.${versionPatch}-alpha.$versionBuild" | ||
} | ||
|
||
class Beta(versionMajor: Int, versionMinor: Int, versionPatch: Int, versionBuild: Int) : | ||
Version(versionMajor, versionMinor, versionPatch, versionBuild) { | ||
override fun toVersionName(): String = | ||
"${versionMajor}.${versionMinor}.${versionPatch}-beta.$versionBuild" | ||
} | ||
|
||
class Stable(versionMajor: Int, versionMinor: Int, versionPatch: Int) : | ||
Version(versionMajor, versionMinor, versionPatch) { | ||
override fun toVersionName(): String = | ||
"${versionMajor}.${versionMinor}.${versionPatch}" | ||
} | ||
|
||
class ReleaseCandidate( | ||
versionMajor: Int, | ||
versionMinor: Int, | ||
versionPatch: Int, | ||
versionBuild: Int | ||
) : | ||
Version(versionMajor, versionMinor, versionPatch, versionBuild) { | ||
override fun toVersionName(): String = | ||
"${versionMajor}.${versionMinor}.${versionPatch}-rc.$versionBuild" | ||
} | ||
} | ||
|
||
val currentVersion: Version = Version.Alpha( | ||
versionMajor = 2, | ||
versionMinor = 0, | ||
versionPatch = 0, | ||
versionBuild = 2 | ||
) | ||
|
||
val versionCode by extra(currentVersion.toVersionCode()) | ||
val versionName by extra(currentVersion.toVersionName()) | ||
|
||
tasks.register("clean", Delete::class) { | ||
delete(rootProject.buildDir) | ||
delete(rootProject.layout.buildDirectory) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters