From 657c2ac613bc8c06cb5b397d06f487e04df1f71c Mon Sep 17 00:00:00 2001 From: Him188 Date: Thu, 20 Aug 2020 12:52:41 +0800 Subject: [PATCH] Fix fillBuildConstants --- backend/mirai-console/build.gradle.kts | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/backend/mirai-console/build.gradle.kts b/backend/mirai-console/build.gradle.kts index 80c2a2fec..5db5a8d7f 100644 --- a/backend/mirai-console/build.gradle.kts +++ b/backend/mirai-console/build.gradle.kts @@ -107,23 +107,25 @@ tasks { val fillBuildConstants by registering { group = "mirai" doLast { - (compileKotlin as KotlinCompile).source.filter { it.name == "MiraiConsole.kt" }.single().let { file -> - file.writeText(file.readText() - .replace(Regex("""val buildDate: Date = Date\((.*)\) //(.*)""")) { - """ + (compileKotlin as KotlinCompile).source.filter { it.name == "MiraiConsoleBuildConstants.kt" }.single() + .let { file -> + file.writeText( + file.readText() + .replace(Regex("""val buildDate: Date = Date\((.*)\) //(.*)""")) { + """ val buildDate: Date = Date(${System.currentTimeMillis()}L) // ${ - SimpleDateFormat("yyyy-MM-dd HH:mm:ss").apply { - timeZone = TimeZone.getTimeZone("GMT+8") - }.format(Date()) - } + SimpleDateFormat("yyyy-MM-dd HH:mm:ss").apply { + timeZone = TimeZone.getTimeZone("GMT+8") + }.format(Date()) + } """.trimIndent() - } - .replace(Regex("""const val version: String = "(.*)"""")) { - """ + } + .replace(Regex("""const val version: String = "(.*)"""")) { + """ const val version: String = "${Versions.console}" """.trimIndent() - } - ) + } + ) } } }