将 COMPILE_TIMESTAMP 改为基于 commit time 的 CODE_TIMESTAMP

This commit is contained in:
A.C.Sukazyo Eyre 2022-11-06 21:43:15 +08:00
parent 5dfe07f586
commit 3c7de7037d
Signed by: Eyre_S
GPG Key ID: C17CE40291207874
4 changed files with 12 additions and 11 deletions

View File

@ -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}")

View File

@ -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

View File

@ -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()
));

View File

@ -243,14 +243,14 @@ public class MornyCommands {
- <code>%s</code>
core md5_hash:
- <code>%s</code>
compile timestamp:
coding timestamp:
- <code>%d</code>
- <code>%s [UTC]</code>""",
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,