Fix nightly versionName/versionCode
This commit is contained in:
@@ -18,8 +18,8 @@ android {
|
|||||||
applicationId 'org.koitharu.kotatsu'
|
applicationId 'org.koitharu.kotatsu'
|
||||||
minSdk = 21
|
minSdk = 21
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 685
|
versionCode = 686
|
||||||
versionName = '7.7-a6'
|
versionName = '7.7-a7'
|
||||||
generatedDensities = []
|
generatedDensities = []
|
||||||
testInstrumentationRunner 'org.koitharu.kotatsu.HiltTestRunner'
|
testInstrumentationRunner 'org.koitharu.kotatsu.HiltTestRunner'
|
||||||
ksp {
|
ksp {
|
||||||
@@ -42,8 +42,6 @@ android {
|
|||||||
nightly {
|
nightly {
|
||||||
initWith release
|
initWith release
|
||||||
applicationIdSuffix = '.nightly'
|
applicationIdSuffix = '.nightly'
|
||||||
defaultConfig.versionCode = LocalDateTime.now().format("yyMMdd").toInteger()
|
|
||||||
defaultConfig.versionName = "N" + LocalDateTime.now().format("yyMMdd")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
@@ -81,6 +79,15 @@ android {
|
|||||||
freeCompilerArgs += ['-opt-in=org.koitharu.kotatsu.parsers.InternalParsersApi']
|
freeCompilerArgs += ['-opt-in=org.koitharu.kotatsu.parsers.InternalParsersApi']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
applicationVariants.configureEach { variant ->
|
||||||
|
if (variant.name == 'nightly') {
|
||||||
|
variant.outputs.each { output ->
|
||||||
|
def now = LocalDateTime.now().format("yyMMdd")
|
||||||
|
output.versionCodeOverride = now.toInteger()
|
||||||
|
output.versionNameOverride = 'N' + now
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
compileDebugKotlin {
|
compileDebugKotlin {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.koitharu.kotatsu.core.github
|
package org.koitharu.kotatsu.core.github
|
||||||
|
|
||||||
import java.util.*
|
import java.util.Locale
|
||||||
|
|
||||||
data class VersionId(
|
data class VersionId(
|
||||||
val major: Int,
|
val major: Int,
|
||||||
@@ -43,6 +43,16 @@ val VersionId.isStable: Boolean
|
|||||||
get() = variantType.isEmpty()
|
get() = variantType.isEmpty()
|
||||||
|
|
||||||
fun VersionId(versionName: String): VersionId {
|
fun VersionId(versionName: String): VersionId {
|
||||||
|
if (versionName.startsWith('n', ignoreCase = true)) {
|
||||||
|
// Nightly build
|
||||||
|
return VersionId(
|
||||||
|
major = 0,
|
||||||
|
minor = 0,
|
||||||
|
build = versionName.drop(1).toIntOrNull() ?: 0,
|
||||||
|
variantType = "n",
|
||||||
|
variantNumber = 0,
|
||||||
|
)
|
||||||
|
}
|
||||||
val parts = versionName.substringBeforeLast('-').split('.')
|
val parts = versionName.substringBeforeLast('-').split('.')
|
||||||
val variant = versionName.substringAfterLast('-', "")
|
val variant = versionName.substringAfterLast('-', "")
|
||||||
return VersionId(
|
return VersionId(
|
||||||
|
|||||||
Reference in New Issue
Block a user