Fix Terminal version rendering.

This commit is contained in:
Karlatemp 2020-09-26 23:51:00 +08:00
parent 05c5e60492
commit 5ef8cec447
No known key found for this signature in database
GPG Key ID: 21FBDDF664FF06F8
4 changed files with 10 additions and 6 deletions

View File

@ -100,8 +100,8 @@ tasks {
})"""
}
.replace(
Regex("""val version: SemVersion = SemVersion.parse\(".*"\)""")
) { """val version: SemVersion = SemVersion.parse("${project.version}")""" }
Regex("""const val versionConst:\s+String\s+=\s+".*"""")
) { """const val versionConst: String = "${project.version}"""" }
)
}
}

View File

@ -14,8 +14,9 @@ import java.time.Instant
internal object MiraiConsoleBuildConstants { // auto-filled on build (task :mirai-console:fillBuildConstants)
@JvmStatic
val buildDate: Instant = Instant.ofEpochSecond(1600663022)
val buildDate: Instant = Instant.ofEpochSecond(1601134282)
const val versionConst: String = "1.0-RC-dev-29"
@JvmStatic
val version: SemVersion = SemVersion("1.0-RC-dev-28")
val version: SemVersion = SemVersion(versionConst)
}

View File

@ -151,7 +151,9 @@ val terminal: Terminal = run {
private object ConsoleFrontEndDescImpl : MiraiConsoleFrontEndDescription {
override val name: String get() = "Terminal"
override val vendor: String get() = "Mamoe Technologies"
override val version: SemVersion = net.mamoe.mirai.console.internal.MiraiConsoleBuildConstants.version
// net.mamoe.mirai.console.internal.MiraiConsoleBuildConstants.version
// is console's version not frontend's version
override val version: SemVersion = SemVersion(net.mamoe.mirai.console.internal.MiraiConsoleBuildConstants.versionConst)
}
private val ANSI_RESET = Ansi().reset().toString()

View File

@ -59,7 +59,8 @@ object MiraiConsoleTerminalLoader {
@ConsoleTerminalExperimentalApi
fun printHelpMessage() {
val help = listOf(
"" to "Mirai-Console[Terminal FrontEnd] v" + kotlin.runCatching {
"" to "Mirai-Console[Terminal FrontEnd] v" + net.mamoe.mirai.console.internal.MiraiConsoleBuildConstants.versionConst,
"" to " [ BackEnd] v" + kotlin.runCatching {
net.mamoe.mirai.console.internal.MiraiConsoleBuildConstants.version
}.getOrElse { "<unknown>" },
"" to "",