mirror of
https://github.com/Eyre-S/Coeur-Morny-Cono.git
synced 2024-11-22 03:04:54 +08:00
将带有 git 的 version 更名为 version-full,原先的 version 去除 git 等附加属性,作为 maven 包版本使用
This commit is contained in:
parent
48a8fd9daa
commit
837ec178d3
@ -43,9 +43,8 @@ final String proj_application_main = "${proj_package}.ServerMain"
|
||||
final String proj_version_base = VERSION
|
||||
final String proj_version_delta = VERSION_DELTA
|
||||
final boolean proj_version_use_delta = Boolean.parseBoolean(USE_DELTA)
|
||||
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 = proj_version_base + (proj_version_use_delta ? "-δ${proj_version_delta}" : "")
|
||||
final String proj_version_full = proj_version + (proj_git ? "+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()
|
||||
|
||||
@ -64,7 +63,7 @@ if (project.hasProperty("publishMvnRepoUrl")) {
|
||||
}
|
||||
|
||||
group proj_group
|
||||
version proj_version
|
||||
version proj_version_full
|
||||
setArchivesBaseName proj_archive_name
|
||||
|
||||
repositories {
|
||||
@ -122,6 +121,7 @@ buildConfig {
|
||||
packageName(proj_package)
|
||||
|
||||
buildConfigField('String', 'VERSION', "\"${proj_version}\"")
|
||||
buildConfigField('String', 'VERSION_FULL', "\"${proj_version_full}\"")
|
||||
buildConfigField('String', 'VERSION_BASE', "\"${proj_version_base}\"")
|
||||
buildConfigField('String', 'VERSION_DELTA', proj_version_use_delta ? "\"${proj_version_delta}\"" : "null")
|
||||
buildConfigField('String', 'CODENAME', "\"${proj_version_codename}\"")
|
||||
|
@ -5,7 +5,7 @@ MORNY_ARCHIVE_NAME = morny-coeur
|
||||
MORNY_CODE_STORE = https://github.com/Eyre-S/Coeur-Morny-Cono
|
||||
MORNY_COMMIT_PATH = https://github.com/Eyre-S/Coeur-Morny-Cono/commit/%s
|
||||
|
||||
VERSION = 1.0.0-alpha4.1
|
||||
VERSION = 1.0.0-alpha4.2
|
||||
|
||||
USE_DELTA = false
|
||||
VERSION_DELTA =
|
||||
|
@ -17,11 +17,23 @@ public class MornySystem {
|
||||
/**
|
||||
* 程序的语义化版本号.
|
||||
* <p>
|
||||
* 这个版本号是完整(verbose)构建的——它包含了以下的 {@link #VERSION_BASE}, {@link #VERSION_DELTA},
|
||||
* 和简写的 {@link BuildConfig#COMMIT} 字段.
|
||||
* 这个版本号包含了以下的 {@link #VERSION_BASE}, {@link #VERSION_DELTA} 字段,
|
||||
* 但不包含作为附加属性的构建时的{@link BuildConfig#COMMIT git 状态}属性
|
||||
* <p>
|
||||
* 这个格式的版本号也是在 maven 包仓库中所使用的版本号
|
||||
* @since 1.0.0-alpha4
|
||||
*/
|
||||
@BuildConfigField @Nonnull public static final String VERSION = BuildConfig.VERSION;
|
||||
/**
|
||||
* 程序的完整语义化版本号.
|
||||
* <p>
|
||||
* 包含了全部的 {@link #VERSION_BASE}, {@link #VERSION_DELTA}, 以及{@link BuildConfig#COMMIT git 状态}属性。
|
||||
* <small>虽然仍旧不包含{@link #CODENAME}属性</small>
|
||||
* <p>
|
||||
* 这个格式的版本号也是 gradle 构建配置使用的版本号,也在普通打包时生成文件时使用
|
||||
* @since 1.0.0-alpha4.2
|
||||
*/
|
||||
@BuildConfigField @Nonnull public static final String VERSION_FULL = BuildConfig.VERSION_FULL;
|
||||
/**
|
||||
* 程序的基础版本号.
|
||||
* <p>
|
||||
@ -37,6 +49,9 @@ public class MornySystem {
|
||||
* {@link null} 作为值,表示这个字段没有被使用.
|
||||
* <p>
|
||||
* 版本 delta 会以 {@code -δversion-delta} 的形式附着在 {@link #VERSION_BASE} 之后.
|
||||
* 两者合并后的版本号格式即为 {@link #VERSION}
|
||||
* <p>
|
||||
* 在发行版本中一般不应该被使用.
|
||||
* <p>
|
||||
* <small>目前并不多被使用.</small>
|
||||
* @since 1.0.0-alpha4
|
||||
|
@ -217,7 +217,7 @@ public class ServerMain {
|
||||
- version %s
|
||||
- Morny %s
|
||||
- <%s> [%d]""",
|
||||
MornySystem.VERSION,
|
||||
MornySystem.VERSION_FULL,
|
||||
MornySystem.CODENAME.toUpperCase(),
|
||||
MornySystem.getJarMd5(), BuildConfig.CODE_TIMESTAMP
|
||||
));
|
||||
|
@ -9,7 +9,7 @@ public class MornyCLI {
|
||||
public static void main (String[] args) {
|
||||
|
||||
Scanner line = new Scanner(System.in);
|
||||
System.out.print("$ java -jar morny-coeur-"+BuildConfig.VERSION+".jar " );
|
||||
System.out.print("$ java -jar morny-coeur-"+MornySystem.VERSION_FULL+".jar " );
|
||||
String x = line.nextLine();
|
||||
ServerMain.main(UniversalCommand.format(x));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user