9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-19 15:09:24 +00:00

Code clean up

This commit is contained in:
XiaoMoMi
2024-08-23 16:03:45 +08:00
parent 661efc92b8
commit 755e4163f1
8 changed files with 38 additions and 23 deletions

View File

@@ -4,8 +4,10 @@ plugins {
id("java")
}
val commitID : String = versionBanner()
ext["commitID"] = commitID
val git : String = versionBanner()
val builder : String = builder()
ext["git_version"] = git
ext["builder"] = builder
subprojects {
@@ -23,13 +25,15 @@ subprojects {
tasks.processResources {
filteringCharset = "UTF-8"
filesMatching(arrayListOf("library-version.properties")) {
filesMatching(arrayListOf("custom-fishing.properties")) {
expand(rootProject.properties)
expand(Pair("builder", builder), Pair("git_version", git))
}
filesMatching(arrayListOf("plugin.yml", "*.yml", "*/*.yml")) {
expand(
Pair("git_version", commitID),
Pair("git_version", git),
Pair("builder", builder),
Pair("project_version", rootProject.properties["project_version"]),
Pair("config_version", rootProject.properties["config_version"])
)
@@ -44,4 +48,13 @@ fun versionBanner(): String {
standardOutput = os
}
return String(os.toByteArray()).trim()
}
fun builder(): String {
val os = ByteArrayOutputStream()
project.exec {
commandLine = "git config user.name".split(" ")
standardOutput = os
}
return String(os.toByteArray()).trim()
}