feat: add version for terminal

This commit is contained in:
Project_IO 2024-09-19 00:58:53 +09:00
parent dfd1934b5e
commit 2616675918
4 changed files with 28 additions and 18 deletions

View file

@ -1,5 +1,7 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("java")
kotlin("jvm") version "2.0.20"
id("com.gradleup.shadow") version "8.3.0"
}
@ -41,6 +43,28 @@ dependencies {
}
tasks {
withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_21)
}
}
processResources {
filesMatching("*.properties") {
expand(project.properties)
}
}
shadowJar {
archiveBaseName.set(project.name)
archiveClassifier.set("")
archiveVersion.set("")
manifest {
attributes["Main-Class"] = "net.projecttl.p.x32.Px32Kt"
}
}
test {
useJUnitPlatform()
}

View file

@ -1,16 +0,0 @@
package net.projecttl.p.x32
import java.util.*
import kotlin.reflect.KProperty
private class DefaultConfigDelegate {
private val props = Properties()
init {
props.load(this.javaClass.getResourceAsStream("/default.properties"))
}
operator fun getValue(thisRef: Any?, property: KProperty<*>): String {
return props.getProperty(property.name).toString()
}
}

View file

@ -2,6 +2,7 @@ package net.projecttl.p.x32
import net.projecttl.p.x32.command.Avatar
import net.projecttl.p.x32.command.Ping
import net.projecttl.p.x32.config.DefaultConfig
import net.projecttl.p.x32.handler.Ready
import net.projecttl.p.x32.kernel.CoreKernel
import org.slf4j.Logger
@ -10,6 +11,7 @@ import org.slf4j.LoggerFactory
val logger: Logger = LoggerFactory.getLogger(Px32::class.java)
fun main() {
logger.info("PX32 version v${DefaultConfig.version}")
val kernel = CoreKernel(System.getenv("TOKEN"))
kernel.addHandler(Ready)

View file

@ -1 +1 @@
version=${version}
version=${project.version}