From 07d864fb5d48dc31ad2f5cb5b07adf3bd0161054 Mon Sep 17 00:00:00 2001 From: Eyre_S Date: Mon, 30 May 2022 23:34:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=20morny=20system=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=20CODENAME=20=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 并添加支持 /runtime /version 命令显示 - 并添加支持 --version 选项显示支持 - 并添加支持启动的版本报告显示支持 --- build.gradle | 3 +++ gradle.properties | 4 +++- .../cc/sukazyo/cono/morny/GradleProjectConfigures.java | 5 +++-- src/main/java/cc/sukazyo/cono/morny/MornySystem.java | 10 ++++++++++ src/main/java/cc/sukazyo/cono/morny/ServerMain.java | 9 +++++---- .../sukazyo/cono/morny/bot/command/MornyCommands.java | 5 ++++- 6 files changed, 28 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 1720565..35dfc91 100644 --- a/build.gradle +++ b/build.gradle @@ -43,6 +43,9 @@ task updateVersionCode { ant.replaceregexp(match:'VERSION = ["a-zA-Z0-9.\\-_+@]+;', replace:"VERSION = \"$project.version\";", flags:'g', byline:true) { fileset(dir: 'src/main/java/cc/sukazyo/cono/morny', includes: 'GradleProjectConfigures.java') } + ant.replaceregexp(match:'CODENAME = ["a-zA-Z0-9]+;', replace:"CODENAME = \"${CODENAME}\";", flags:'g', byline:true) { + fileset(dir: 'src/main/java/cc/sukazyo/cono/morny', includes: 'GradleProjectConfigures.java') + } ant.replaceregexp(match:'COMPILE_TIMESTAMP = [0-9]+L;', replace:"COMPILE_TIMESTAMP = ${System.currentTimeMillis()}L;", flags:'g', byline:true) { fileset(dir: 'src/main/java/cc/sukazyo/cono/morny', includes: 'GradleProjectConfigures.java') } diff --git a/gradle.properties b/gradle.properties index 435c0cb..1b57c05 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,8 @@ ## Core -VERSION = 0.7.0.13 +VERSION = 0.7.0.14 + +CODENAME = fuzhou # dependencies diff --git a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java index ce9ca67..48e6fba 100644 --- a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java +++ b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java @@ -4,6 +4,7 @@ package cc.sukazyo.cono.morny; * the final field that will be updated by gradle automatically. */ public class GradleProjectConfigures { - public static final String VERSION = "0.7.0.13"; - public static final long COMPILE_TIMESTAMP = 1653744934038L; + public static final String VERSION = "0.7.0.14"; + public static final String CODENAME = "fuzhou"; + public static final long COMPILE_TIMESTAMP = 1653924732379L; } diff --git a/src/main/java/cc/sukazyo/cono/morny/MornySystem.java b/src/main/java/cc/sukazyo/cono/morny/MornySystem.java index 4dbca43..e9a486d 100644 --- a/src/main/java/cc/sukazyo/cono/morny/MornySystem.java +++ b/src/main/java/cc/sukazyo/cono/morny/MornySystem.java @@ -18,6 +18,16 @@ public class MornySystem { */ public static final String VERSION = GradleProjectConfigures.VERSION; + /** + * Morny Coeur 当前的版本代号.
+ * 一个单个单词,一般作为一个大版本的名称,只在重大更新改变
+ * 格式保持为仅由小写字母和数字组成
+ * 有时也可能是复合词或特殊的词句
+ *
+ * 会由 gradle 任务 {@code updateVersionCode} 更新 + */ + public static final String CODENAME = GradleProjectConfigures.CODENAME; + /** * 获取程序 jar 文件的 md5-hash 值
*
diff --git a/src/main/java/cc/sukazyo/cono/morny/ServerMain.java b/src/main/java/cc/sukazyo/cono/morny/ServerMain.java index bec90e2..eb1ef08 100644 --- a/src/main/java/cc/sukazyo/cono/morny/ServerMain.java +++ b/src/main/java/cc/sukazyo/cono/morny/ServerMain.java @@ -177,13 +177,13 @@ public class ServerMain { logger.info(String.format(""" Morny Cono Version - version : - %s + %s %s - md5hash : %s - co.time : %d %s [UTC]""", - MornySystem.VERSION, + MornySystem.VERSION, MornySystem.CODENAME.toUpperCase(), MornySystem.getJarMd5(), GradleProjectConfigures.COMPILE_TIMESTAMP, CommonFormatUtils.formatDate(GradleProjectConfigures.COMPILE_TIMESTAMP, 0) @@ -197,8 +197,9 @@ public class ServerMain { logger.info(String.format(""" ServerMain.java Loaded >>> - - version %s(%s)(%d)""", - MornySystem.VERSION, MornySystem.getJarMd5(), GradleProjectConfigures.COMPILE_TIMESTAMP + - version %s %s (%s)(%d)""", + MornySystem.VERSION, MornySystem.CODENAME.toUpperCase(), + MornySystem.getJarMd5(), GradleProjectConfigures.COMPILE_TIMESTAMP )); //# 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 f61c7f6..1975177 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 @@ -229,12 +229,14 @@ public class MornyCommands { String.format( """ version: + - Morny %s - %s core md5_hash: - %s compile timestamp: - %d - %s [UTC]""", + escapeHtml(MornySystem.CODENAME.toUpperCase()), escapeHtml(MornySystem.VERSION), escapeHtml(MornySystem.getJarMd5()), GradleProjectConfigures.COMPILE_TIMESTAMP, @@ -274,7 +276,7 @@ public class MornyCommands { - %d / %d MB - %d cores coeur version: - - %s + - %s (%s) - %s - %s [UTC] - [%d] @@ -296,6 +298,7 @@ public class MornyCommands { Runtime.getRuntime().availableProcessors(), // version escapeHtml(MornySystem.VERSION), + escapeHtml(MornySystem.CODENAME), escapeHtml(MornySystem.getJarMd5()), escapeHtml(formatDate(GradleProjectConfigures.COMPILE_TIMESTAMP, 0)), GradleProjectConfigures.COMPILE_TIMESTAMP,