为 morny system 添加了 CODENAME 属性

- 并添加支持 /runtime /version 命令显示
- 并添加支持 --version 选项显示支持
- 并添加支持启动的版本报告显示支持
This commit is contained in:
A.C.Sukazyo Eyre 2022-05-30 23:34:49 +08:00
parent c4bdf2846b
commit 07d864fb5d
Signed by: Eyre_S
GPG Key ID: EFB47D98FE082FAD
6 changed files with 28 additions and 8 deletions

View File

@ -43,6 +43,9 @@ task updateVersionCode {
ant.replaceregexp(match:'VERSION = ["a-zA-Z0-9.\\-_+@]+;', replace:"VERSION = \"$project.version\";", flags:'g', byline:true) { 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') 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) { 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') fileset(dir: 'src/main/java/cc/sukazyo/cono/morny', includes: 'GradleProjectConfigures.java')
} }

View File

@ -1,6 +1,8 @@
## Core ## Core
VERSION = 0.7.0.13 VERSION = 0.7.0.14
CODENAME = fuzhou
# dependencies # dependencies

View File

@ -4,6 +4,7 @@ package cc.sukazyo.cono.morny;
* the final field that will be updated by gradle automatically. * the final field that will be updated by gradle automatically.
*/ */
public class GradleProjectConfigures { public class GradleProjectConfigures {
public static final String VERSION = "0.7.0.13"; public static final String VERSION = "0.7.0.14";
public static final long COMPILE_TIMESTAMP = 1653744934038L; public static final String CODENAME = "fuzhou";
public static final long COMPILE_TIMESTAMP = 1653924732379L;
} }

View File

@ -18,6 +18,16 @@ public class MornySystem {
*/ */
public static final String VERSION = GradleProjectConfigures.VERSION; public static final String VERSION = GradleProjectConfigures.VERSION;
/**
* Morny Coeur 当前的版本代号.<br>
* 一个单个单词一般作为一个大版本的名称只在重大更新改变<br>
* 格式保持为仅由小写字母和数字组成<br>
* 有时也可能是复合词或特殊的词句<br>
* <br>
* 会由 gradle 任务 {@code updateVersionCode} 更新
*/
public static final String CODENAME = GradleProjectConfigures.CODENAME;
/** /**
* 获取程序 jar 文件的 md5-hash <br> * 获取程序 jar 文件的 md5-hash <br>
* <br> * <br>

View File

@ -177,13 +177,13 @@ public class ServerMain {
logger.info(String.format(""" logger.info(String.format("""
Morny Cono Version Morny Cono Version
- version : - version :
%s %s %s
- md5hash : - md5hash :
%s %s
- co.time : - co.time :
%d %d
%s [UTC]""", %s [UTC]""",
MornySystem.VERSION, MornySystem.VERSION, MornySystem.CODENAME.toUpperCase(),
MornySystem.getJarMd5(), MornySystem.getJarMd5(),
GradleProjectConfigures.COMPILE_TIMESTAMP, GradleProjectConfigures.COMPILE_TIMESTAMP,
CommonFormatUtils.formatDate(GradleProjectConfigures.COMPILE_TIMESTAMP, 0) CommonFormatUtils.formatDate(GradleProjectConfigures.COMPILE_TIMESTAMP, 0)
@ -197,8 +197,9 @@ public class ServerMain {
logger.info(String.format(""" logger.info(String.format("""
ServerMain.java Loaded >>> ServerMain.java Loaded >>>
- version %s(%s)(%d)""", - version %s %s (%s)(%d)""",
MornySystem.VERSION, MornySystem.getJarMd5(), GradleProjectConfigures.COMPILE_TIMESTAMP MornySystem.VERSION, MornySystem.CODENAME.toUpperCase(),
MornySystem.getJarMd5(), GradleProjectConfigures.COMPILE_TIMESTAMP
)); ));
//# //#

View File

@ -229,12 +229,14 @@ public class MornyCommands {
String.format( String.format(
""" """
version: version:
- Morny <code>%s</code>
- <code>%s</code> - <code>%s</code>
core md5_hash: core md5_hash:
- <code>%s</code> - <code>%s</code>
compile timestamp: compile timestamp:
- <code>%d</code> - <code>%d</code>
- <code>%s [UTC]</code>""", - <code>%s [UTC]</code>""",
escapeHtml(MornySystem.CODENAME.toUpperCase()),
escapeHtml(MornySystem.VERSION), escapeHtml(MornySystem.VERSION),
escapeHtml(MornySystem.getJarMd5()), escapeHtml(MornySystem.getJarMd5()),
GradleProjectConfigures.COMPILE_TIMESTAMP, GradleProjectConfigures.COMPILE_TIMESTAMP,
@ -274,7 +276,7 @@ public class MornyCommands {
- <code>%d</code> / <code>%d</code> MB - <code>%d</code> / <code>%d</code> MB
- <code>%d</code> cores - <code>%d</code> cores
coeur version: coeur version:
- <code>%s</code> - <code>%s</code> (<code>%s</code>)
- <code>%s</code> - <code>%s</code>
- <code>%s [UTC]</code> - <code>%s [UTC]</code>
- [<code>%d</code>] - [<code>%d</code>]
@ -296,6 +298,7 @@ public class MornyCommands {
Runtime.getRuntime().availableProcessors(), Runtime.getRuntime().availableProcessors(),
// version // version
escapeHtml(MornySystem.VERSION), escapeHtml(MornySystem.VERSION),
escapeHtml(MornySystem.CODENAME),
escapeHtml(MornySystem.getJarMd5()), escapeHtml(MornySystem.getJarMd5()),
escapeHtml(formatDate(GradleProjectConfigures.COMPILE_TIMESTAMP, 0)), escapeHtml(formatDate(GradleProjectConfigures.COMPILE_TIMESTAMP, 0)),
GradleProjectConfigures.COMPILE_TIMESTAMP, GradleProjectConfigures.COMPILE_TIMESTAMP,