WebInterface/build.gradle.kts
akastijn f42777c62a Update Login URL handling and optimize ShadowJar build process
- Fix `resolveLogin` method to ensure correct login endpoint formatting.
- Update default `LOGIN_CODE_ENDPOINT` in `Config` to reflect new API path.
- Adjust ShadowJar build to transform SLF4J service files and exclude SLF4J dependencies during minimization.
2025-07-31 23:05:06 +02:00

68 lines
2.0 KiB
Plaintext

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id("java")
id("com.gradleup.shadow") version "9.0.0-beta17"
}
group = "com.alttd.webinterface"
version = "1.0-SNAPSHOT"
description = "WebInterface"
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
repositories {
mavenCentral()
maven("https://nexus.velocitypowered.com/repository/maven-public/")
maven("https://jitpack.io") //Litebans
}
dependencies {
compileOnly("com.velocitypowered:velocity-api:3.1.2-SNAPSHOT") // Velocity
annotationProcessor("com.velocitypowered:velocity-api:3.1.2-SNAPSHOT")
compileOnly("com.gitlab.ruany:LiteBansAPI:0.6.1")
compileOnly("org.projectlombok:lombok:1.18.30")
annotationProcessor("org.projectlombok:lombok:1.18.30")
implementation("io.javalin:javalin:6.6.0") // Javalin for HTTP server
implementation("org.slf4j:slf4j-api:2.0.9") // Required by Javalin
implementation("org.slf4j:slf4j-simple:2.0.16") // Add SLF4J implementation
}
tasks.test {
useJUnitPlatform()
}
tasks.withType<ShadowJar> {
// Relocate packages to avoid conflicts with other plugins
relocate("io.javalin", "com.alttd.webinterface.shaded.io.javalin")
relocate("org.slf4j", "com.alttd.webinterface.shaded.org.slf4j")
relocate("kotlin", "com.alttd.webinterface.shaded.kotlin")
relocate("org.eclipse.jetty", "com.alttd.webinterface.shaded.org.eclipse.jetty")
// Transform service files for SLF4J to use the relocated packages
transform(com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer::class.java)
minimize {
// Exclude SLF4J to prevent minimization from removing required classes
exclude(dependency("org.slf4j:.*:.*"))
}
}
tasks.build {
dependsOn(tasks.shadowJar)
}
tasks.jar {
enabled = false
}
artifacts {
archives(tasks.shadowJar)
}