import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation import java.io.ByteArrayOutputStream plugins { id("java") id("com.github.johnrengelman.shadow") version "7.1.0" } group = "com.alttd" version = System.getenv("BUILD_NUMBER") ?: gitCommit() description = "Altitude AFK Detector plugin." apply() java { toolchain { languageVersion.set(JavaLanguageVersion.of(17)) } } tasks { withType { options.encoding = Charsets.UTF_8.name() } withType { options.encoding = Charsets.UTF_8.name() } shadowJar { dependsOn(getByName("relocateJars") as ConfigureShadowRelocation) archiveFileName.set("${project.name}-${project.version}.jar") minimize() configurations = listOf(project.configurations.shadow.get()) } build { dependsOn(shadowJar) } create("relocateJars") { target = shadowJar.get() prefix = "${project.name}.lib" } } dependencies { implementation("com.alttd:Galaxy-API:1.20.4-R0.1-SNAPSHOT") compileOnly("de.keyle:mypet:3.11-SNAPSHOT") } fun gitCommit(): String { val os = ByteArrayOutputStream() project.exec { isIgnoreExitValue = true commandLine = "git rev-parse --short HEAD".split(" ") standardOutput = os } return String(os.toByteArray()).trim() }