mirror of
https://github.com/twinksoftware/Gearslip.git
synced 2026-11-11 00:12:24 +01:00
The version now comes from the git tag, so a build can't disagree with its release
Builds after a tag name themselves after it plus the commits since, and the version code is worked out from the numbers instead of set by hand.
This commit is contained in:
1 parent
6e6a77d554
commit
9938efb706
4 files changed
+44
-5
No files matched your search
@@ -4,6 +4,10 @@ package app.seb3thehacker.gearslip
|
||||
* What changed in each release, newest first, shown on the car screen after an update (and on
|
||||
* the phone). Only the changes a driver would notice. Plain words, short lines: this is read in
|
||||
* a parked car.
|
||||
*
|
||||
* After 0.3.40, the version code is the one the build works out from the tag (see gitVersion in
|
||||
* build.gradle.kts): ((major*100 + minor)*100 + patch)*10 + stage, so 0.4.0-beta is 4002. Older
|
||||
* entries keep the hand-set codes they shipped with, which are all lower.
|
||||
*/
|
||||
object Changelog {
|
||||
|
||||
|
||||
@@ -578,12 +578,14 @@ object UpdateChecker {
|
||||
/**
|
||||
* "0.2.00-alpha" beats "0.1.10-alpha": the numbers before the dash compare one by one. With the
|
||||
* same numbers, a plain release beats a beta, and a beta beats an alpha, so "0.3.0" reaches
|
||||
* someone on "0.3.0-beta".
|
||||
* someone on "0.3.0-beta". Anything after a "+" only says which commit a test build came from,
|
||||
* so "0.3.0-beta+4.ba4374e" counts the same as "0.3.0-beta".
|
||||
*/
|
||||
internal fun isNewer(candidate: String, installed: String): Boolean {
|
||||
fun parts(v: String) = v.removePrefix("v").substringBefore('-').split('.').map { it.toIntOrNull() ?: 0 }
|
||||
fun core(v: String) = v.removePrefix("v").substringBefore('+')
|
||||
fun parts(v: String) = core(v).substringBefore('-').split('.').map { it.toIntOrNull() ?: 0 }
|
||||
fun stage(v: String): Int {
|
||||
val tag = v.substringAfter('-', "").lowercase()
|
||||
val tag = core(v).substringAfter('-', "").lowercase()
|
||||
return when {
|
||||
tag.isEmpty() -> 3
|
||||
"beta" in tag -> 2
|
||||
|
||||
Reference in new issue
Block a user