Fix version on continuous build

This commit is contained in:
vvb2060 2021-01-25 23:33:09 +08:00 committed by topjohnwu
parent 1024e68eb6
commit 93961dde2c

View File

@ -1,4 +1,3 @@
import org.eclipse.jgit.api.Git import org.eclipse.jgit.api.Git
import org.eclipse.jgit.internal.storage.file.FileRepository import org.eclipse.jgit.internal.storage.file.FileRepository
import org.gradle.api.Plugin import org.gradle.api.Plugin
@ -12,13 +11,14 @@ private lateinit var commitHash: String
private var commitCount = 0 private var commitCount = 0
object Config { object Config {
operator fun get(key: String) : String? { operator fun get(key: String): String? {
val v = props[key] as? String ?: return null val v = props[key] as? String ?: return null
return if (v.isBlank()) null else v return if (v.isBlank()) null else v
} }
fun contains(key: String) = get(key) != null fun contains(key: String) = get(key) != null
val version: String = get("version") ?: commitHash val version: String get() = get("version") ?: commitHash
val versionCode: Int get() = get("magisk.versionCode")!!.toInt() val versionCode: Int get() = get("magisk.versionCode")!!.toInt()
val stubVersion: String get() = get("magisk.stubVersion")!! val stubVersion: String get() = get("magisk.stubVersion")!!
} }