ffb716ca1c
Ajoute une tâche Gradle `copyJarToDevServer` finalisant shadowJar : le fat JAR est copié dans C:/Users/minit/Desktop/HYTALE SERVER/Server/mods par défaut. Overridable via -PdevServerMods=... et désactivable avec -PdevServerMods=disabled.
97 lines
2.7 KiB
Kotlin
97 lines
2.7 KiB
Kotlin
plugins {
|
|
id("java-library")
|
|
id("com.gradleup.shadow") version "9.3.1"
|
|
}
|
|
|
|
group = findProperty("pluginGroup") as String? ?: "com.mythlane"
|
|
version = findProperty("pluginVersion") as String? ?: "0.1.0"
|
|
description = findProperty("pluginDescription") as String? ?: "Hytale Gravity Flip"
|
|
|
|
val hytaleServerVersion: String by project
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
mavenCentral()
|
|
maven {
|
|
name = "hytale"
|
|
url = uri("https://maven.hytale.com/release")
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
compileOnly("com.hypixel.hytale:Server:$hytaleServerVersion")
|
|
|
|
implementation("com.google.code.gson:gson:2.10.1")
|
|
implementation("org.jetbrains:annotations:24.1.0")
|
|
|
|
// Tests need the Hytale Server API (codecs, ExtraInfo, BsonValue) on the classpath.
|
|
testImplementation("com.hypixel.hytale:Server:$hytaleServerVersion")
|
|
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
|
|
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
|
}
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion.set(JavaLanguageVersion.of(25))
|
|
}
|
|
}
|
|
|
|
tasks {
|
|
compileJava {
|
|
options.encoding = Charsets.UTF_8.name()
|
|
options.release = 25
|
|
}
|
|
|
|
processResources {
|
|
filteringCharset = Charsets.UTF_8.name()
|
|
val props = mapOf(
|
|
"group" to project.group,
|
|
"version" to project.version,
|
|
"description" to project.description,
|
|
"hytaleServerVersion" to hytaleServerVersion
|
|
)
|
|
inputs.properties(props)
|
|
filesMatching("manifest.json") {
|
|
expand(props)
|
|
}
|
|
}
|
|
|
|
shadowJar {
|
|
archiveBaseName.set("hytale-gravity-flip")
|
|
archiveClassifier.set("")
|
|
relocate("com.google.gson", "com.mythlane.gravityflip.libs.gson")
|
|
}
|
|
|
|
jar {
|
|
enabled = false
|
|
}
|
|
|
|
// Auto-copy le fat JAR vers le dossier mods du serveur dev Hytale après shadowJar.
|
|
// Override via -PdevServerMods=... ou la propriété `devServerMods` dans gradle.properties.
|
|
// Désactivable via -PdevServerMods=disabled (ou valeur vide).
|
|
val devServerModsDefault = "C:/Users/minit/Desktop/HYTALE SERVER/Server/mods"
|
|
val copyJarToDevServer by registering(Copy::class) {
|
|
val target = (findProperty("devServerMods") as String? ?: devServerModsDefault).trim()
|
|
onlyIf {
|
|
target.isNotEmpty() && target != "disabled" && file(target).isDirectory
|
|
}
|
|
from(shadowJar)
|
|
into(target)
|
|
doLast {
|
|
logger.lifecycle("[copyJarToDevServer] Copié vers $target")
|
|
}
|
|
}
|
|
|
|
shadowJar {
|
|
finalizedBy(copyJarToDevServer)
|
|
}
|
|
|
|
build {
|
|
dependsOn(shadowJar)
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
}
|
|
}
|