From 3c7de7037d7976c58bcf02963bc730eba359c7f5 Mon Sep 17 00:00:00 2001 From: Eyre_S Date: Sun, 6 Nov 2022 21:43:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=20COMPILE=5FTIMESTAMP=20=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=9F=BA=E4=BA=8E=20commit=20time=20=E7=9A=84=20CODE?= =?UTF-8?q?=5FTIMESTAMP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 3 ++- gradle.properties | 4 ++-- src/main/java/cc/sukazyo/cono/morny/ServerMain.java | 6 +++--- .../sukazyo/cono/morny/bot/command/MornyCommands.java | 10 +++++----- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index ea2f560..c951ab2 100644 --- a/build.gradle +++ b/build.gradle @@ -44,6 +44,7 @@ String proj_version = proj_version_base if (proj_version_use_delta) proj_version += "-δ${proj_version_delta}" if (proj_git) proj_version += "+git.${proj_commit.substring(0, 8)}" + (proj_clean?"":".δ") final String proj_version_codename = CODENAME +final long proj_code_time = proj_clean ? grgit.head().dateTime.toInstant().toEpochMilli() : System.currentTimeMillis() final JavaVersion proj_java = JavaVersion.VERSION_17 final Charset proj_file_encoding = StandardCharsets.UTF_8 @@ -107,7 +108,7 @@ buildConfig { buildConfigField('String', 'VERSION', "\"${proj_version}\"") buildConfigField('String', 'VERSION_DELTA', "\"${proj_version_delta}\"") buildConfigField('String', 'CODENAME', "\"${proj_version_codename}\"") - buildConfigField('long', 'COMPILE_TIMESTAMP', "${System.currentTimeMillis()}L") + buildConfigField('long', 'CODE_TIMESTAMP', "${proj_code_time}L") buildConfigField('String', 'COMMIT', proj_git ? "\"${proj_commit}\"" : "null") buildConfigField('boolean', 'CLEAN_BUILD', "${proj_clean}") diff --git a/gradle.properties b/gradle.properties index b65028a..01d5e1a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,10 +2,10 @@ MORNY_ARCHIVE_NAME = morny-coeur -VERSION = 1.0.0-alpha2 +VERSION = 1.0.0-alpha3 USE_DELTA = true -VERSION_DELTA = 11061900 +VERSION_DELTA = 11061142 CODENAME = beiping diff --git a/src/main/java/cc/sukazyo/cono/morny/ServerMain.java b/src/main/java/cc/sukazyo/cono/morny/ServerMain.java index 2e330b2..6c720f8 100644 --- a/src/main/java/cc/sukazyo/cono/morny/ServerMain.java +++ b/src/main/java/cc/sukazyo/cono/morny/ServerMain.java @@ -192,8 +192,8 @@ public class ServerMain { %s [UTC]""", MornySystem.VERSION, MornySystem.CODENAME.toUpperCase(), MornySystem.getJarMd5(), - BuildConfig.COMPILE_TIMESTAMP, - CommonFormat.formatDate(BuildConfig.COMPILE_TIMESTAMP, 0) + BuildConfig.CODE_TIMESTAMP, + CommonFormat.formatDate(BuildConfig.CODE_TIMESTAMP, 0) )); return; @@ -207,7 +207,7 @@ public class ServerMain { - version %s (%s)(%d) - Morny %s""", MornySystem.VERSION, - MornySystem.getJarMd5(), BuildConfig.COMPILE_TIMESTAMP, + MornySystem.getJarMd5(), BuildConfig.CODE_TIMESTAMP, MornySystem.CODENAME.toUpperCase() )); diff --git a/src/main/java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java b/src/main/java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java index 4bbe09c..8b6f124 100644 --- a/src/main/java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java +++ b/src/main/java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java @@ -243,14 +243,14 @@ public class MornyCommands { - %s core md5_hash: - %s - compile timestamp: + coding timestamp: - %d - %s [UTC]""", escapeHtml(MornySystem.CODENAME.toUpperCase()), escapeHtml(MornySystem.VERSION), escapeHtml(MornySystem.getJarMd5()), - BuildConfig.COMPILE_TIMESTAMP, - escapeHtml(formatDate(BuildConfig.COMPILE_TIMESTAMP, 0)) + BuildConfig.CODE_TIMESTAMP, + escapeHtml(formatDate(BuildConfig.CODE_TIMESTAMP, 0)) ) ).replyToMessageId(event.message().messageId()).parseMode(ParseMode.HTML)); } @@ -310,8 +310,8 @@ public class MornyCommands { escapeHtml(MornySystem.VERSION), escapeHtml(MornySystem.CODENAME), escapeHtml(MornySystem.getJarMd5()), - escapeHtml(formatDate(BuildConfig.COMPILE_TIMESTAMP, 0)), - BuildConfig.COMPILE_TIMESTAMP, + escapeHtml(formatDate(BuildConfig.CODE_TIMESTAMP, 0)), + BuildConfig.CODE_TIMESTAMP, // continuous escapeHtml(formatDuration(System.currentTimeMillis() - MornyCoeur.coeurStartTimestamp)), System.currentTimeMillis() - MornyCoeur.coeurStartTimestamp,