LibsDisguises/shaded/build.gradle.kts

119 lines
3.3 KiB
Plaintext
Raw Normal View History

2024-08-05 13:12:51 +02:00
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
plugins {
2024-08-05 16:22:00 +02:00
java
2024-08-05 13:12:51 +02:00
alias(libs.plugins.shadowjar)
application
}
tasks {
build {
dependsOn("shadowJar")
dependsOn("run")
dependsOn(getByName("jenkins"))
}
task("publish") {
dependsOn("build")
}
shadowJar {
configurations = listOf(project.configurations.shadow.get())
exclude("**/CompileMethods.class")
}
getByName("run") {
mustRunAfter(shadowJar)
}
task("jenkins") {
mustRunAfter("run")
2024-08-06 11:46:50 +02:00
doLast {
copy {
from(shadowJar.get().archiveFile.get().asFile.absolutePath)
into(rootProject.projectDir.absolutePath + "\\target")
rename {
"LibsDisguises.jar"
}
}
}
2024-08-05 13:12:51 +02:00
}
processResources {
// Always inject timestamp & version
outputs.upToDateWhen { false }
filesMatching("plugin.yml") {
expand(
"libsdisguisesVersion" to project(":plugin").version,
"timestamp" to DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm").format(LocalDateTime.now()),
2024-08-05 16:22:00 +02:00
"buildNumber" to System.getProperty("build.number", "unknown")
2024-08-05 13:12:51 +02:00
)
}
}
}
application {
mainClass = "me.libraryaddict.disguise.utilities.watchers.CompileMethods"
applicationDefaultJvmArgs = listOf(
"-Djar.path=" + tasks.named<ShadowJar>("shadowJar").get().archiveFile.get().asFile.absolutePath
)
}
testing {
suites {
val test by getting(JvmTestSuite::class) {
useJUnitJupiter()
}
}
}
dependencies {
shadow(project(":minimessage", "shadow")) {
2024-08-05 13:12:51 +02:00
exclude("*")
}
shadow(project(":shared")) {
exclude("*")
}
shadow(project(":plugin")) {
exclude("*")
}
runtimeOnly(project(":plugin"))
runtimeOnly(libs.com.retro.packetevents)
(gradle.extra["nmsModules"] as List<*>).map { s -> project(s as String) }.forEach {
shadow(it) {
exclude("*")
}
}
testCompileOnly(libs.org.projectlombok.lombok)
testAnnotationProcessor(libs.org.projectlombok.lombok)
// Dependencies that are used to compile, and will also be provided at test runtime
2024-08-05 13:12:51 +02:00
testImplementation(project(":shared"))
testImplementation(project(":plugin"))
testImplementation(project(":minimessage", "shadow"))
2024-08-05 13:12:51 +02:00
testImplementation(libs.mockito)
testImplementation(libs.com.retro.packetevents)
testImplementation(libs.net.kyori.adventure.api)
testImplementation(libs.net.kyori.adventure.text.minimessage)
testImplementation(libs.net.kyori.adventure.text.serializer.gson)
testImplementation(libs.net.kyori.adventure.text.serializer.json)
// dependencies that are only used when running the tests
2024-08-05 13:12:51 +02:00
testRuntimeOnly(libs.org.spigotmc.spigot.api)
testRuntimeOnly(libs.org.spigotmc.spigot)
testRuntimeOnly(libs.commons.lang.commons.lang)
2024-08-05 14:58:38 +02:00
testRuntimeOnly(libs.io.netty.netty.buffer)
testRuntimeOnly(libs.io.netty.netty.codec)
2024-08-05 15:01:22 +02:00
testRuntimeOnly(libs.com.mojang.authlib.new)
2024-08-05 14:46:10 +02:00
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}