Fix nightly versionName/versionCode
This commit is contained in:
@@ -18,8 +18,8 @@ android {
|
||||
applicationId 'org.koitharu.kotatsu'
|
||||
minSdk = 21
|
||||
targetSdk = 35
|
||||
versionCode = 685
|
||||
versionName = '7.7-a6'
|
||||
versionCode = 686
|
||||
versionName = '7.7-a7'
|
||||
generatedDensities = []
|
||||
testInstrumentationRunner 'org.koitharu.kotatsu.HiltTestRunner'
|
||||
ksp {
|
||||
@@ -42,8 +42,6 @@ android {
|
||||
nightly {
|
||||
initWith release
|
||||
applicationIdSuffix = '.nightly'
|
||||
defaultConfig.versionCode = LocalDateTime.now().format("yyMMdd").toInteger()
|
||||
defaultConfig.versionName = "N" + LocalDateTime.now().format("yyMMdd")
|
||||
}
|
||||
}
|
||||
buildFeatures {
|
||||
@@ -81,6 +79,15 @@ android {
|
||||
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 {
|
||||
compileDebugKotlin {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.koitharu.kotatsu.core.github
|
||||
|
||||
import java.util.*
|
||||
import java.util.Locale
|
||||
|
||||
data class VersionId(
|
||||
val major: Int,
|
||||
@@ -43,6 +43,16 @@ val VersionId.isStable: Boolean
|
||||
get() = variantType.isEmpty()
|
||||
|
||||
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 variant = versionName.substringAfterLast('-', "")
|
||||
return VersionId(
|
||||
|
||||
Reference in New Issue
Block a user