添加了args命令检查项目版本,将项目 jvm 升级为 java17,更新 gradle 版本号自动更新机制,日常依赖更新

This commit is contained in:
A.C.Sukazyo Eyre 2021-12-05 20:15:51 +08:00
parent 1844c386c8
commit 2ba05b2a81
Signed by: Eyre_S
GPG Key ID: EFB47D98FE082FAD
5 changed files with 89 additions and 8 deletions

View File

@ -7,7 +7,7 @@ plugins {
} }
group 'cc.sukazyo' group 'cc.sukazyo'
version '0.3.4.1' version '0.3.4.2'
project.ext.archiveBaseName = 'Coeur_Morny_Cono' project.ext.archiveBaseName = 'Coeur_Morny_Cono'
project.ext.artifactId = 'morny-coeur' project.ext.artifactId = 'morny-coeur'
mainClassName = 'cc.sukazyo.cono.morny.MornyCoeur' mainClassName = 'cc.sukazyo.cono.morny.MornyCoeur'
@ -20,16 +20,16 @@ dependencies {
compileOnlyApi "com.github.spotbugs:spotbugs-annotations:4.5.0" compileOnlyApi "com.github.spotbugs:spotbugs-annotations:4.5.0"
implementation 'com.github.pengrad:java-telegram-bot-api:5.3.0' implementation 'com.github.pengrad:java-telegram-bot-api:5.4.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
} }
task updateVersionCode { 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: 'MornySystem.java') fileset(dir: 'src/main/java/cc/sukazyo/cono/morny', includes: 'GradleProjectConfigures.java')
} }
} }
@ -40,7 +40,12 @@ test {
} }
java { java {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
withSourcesJar() withSourcesJar()
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {

View File

@ -0,0 +1,8 @@
package cc.sukazyo.cono.morny;
/**
* the final field that will be updated by gradle automatically.
*/
public class GradleProjectConfigures {
public static final String VERSION = "0.3.4.2";
}

View File

@ -34,12 +34,24 @@ public class MornyCoeur {
* - 第一个参数({@code args[0]})必序传递值为 telegram-bot api-token<br> * - 第一个参数({@code args[0]})必序传递值为 telegram-bot api-token<br>
* - 第二个参数可选 {@code --no-hello} {@code --only-hello} * - 第二个参数可选 {@code --no-hello} {@code --only-hello}
* 前者表示不输出{@link MornyHello#MORNY_PREVIEW_IMAGE_ASCII 欢迎标语} * 前者表示不输出{@link MornyHello#MORNY_PREVIEW_IMAGE_ASCII 欢迎标语}
* 后者表示只输出{@link MornyHello#MORNY_PREVIEW_IMAGE_ASCII 欢迎标语}而不运行程序逻辑 * 后者表示只输出{@link MornyHello#MORNY_PREVIEW_IMAGE_ASCII 欢迎标语}而不运行程序逻辑<br>
* <br>
* 或者在第一个参数处使用 {@code --version} 来输出当前程序的版本信息
* *
* @param args 程序命令行参数 * @param args 程序命令行参数
*/ */
public static void main (@Nonnull String[] args) { public static void main (@Nonnull String[] args) {
if ("--version".equals(args[0])) {
logger.info(String.format("""
Morny Cono Version
- version : %s
- md5hash : %s
""", MornySystem.VERSION, MornySystem.getJarMd5()
));
return;
}
if (!(args.length > 1 && "--no-hello".equals(args[1]))) if (!(args.length > 1 && "--no-hello".equals(args[1])))
logger.info(MornyHello.MORNY_PREVIEW_IMAGE_ASCII); logger.info(MornyHello.MORNY_PREVIEW_IMAGE_ASCII);
if (args.length > 1 && "--only-hello".equals(args[1])) if (args.length > 1 && "--only-hello".equals(args[1]))

File diff suppressed because one or more lines are too long

View File

@ -14,7 +14,7 @@ public class MornySystem {
* 程序的语义化版本号<br> * 程序的语义化版本号<br>
* 会由 gradle 任务 {@code updateVersionCode} 更新 * 会由 gradle 任务 {@code updateVersionCode} 更新
*/ */
public static final String VERSION = "0.3.4.1"; public static final String VERSION = GradleProjectConfigures.VERSION;
/** /**
* 获取程序 jar 文件的 md5-hash <br> * 获取程序 jar 文件的 md5-hash <br>