import java.io.FileOutputStream import java.net.URL import java.io.ByteArrayOutputStream plugins { id("java") id("java-library") id("io.github.goooler.shadow") version "8.1.8" id("maven-publish") } allprojects { group = "com.alttd.essentia" version = "Build-" + (System.getenv("BUILD_NUMBER") ?: gitCommit()) description = "Altitude essentials ;)" apply() java { toolchain { languageVersion.set(JavaLanguageVersion.of(21)) } } } subprojects { apply() apply(plugin = "maven-publish") publishing { configure { repositories { maven { name = "maven" url = uri("https://repo.destro.xyz/snapshots/") credentials(PasswordCredentials::class) } } } } } dependencies { implementation(project(":api")) implementation(project(":plugin")) } tasks { shadowJar { archiveFileName.set("${project.name}.jar") minimize() { exclude { it.moduleName == "api" } exclude { it.moduleName == "plugin" } } listOf( "xyz.destro.utheo.comet" ).forEach { relocate(it, "${rootProject.group}.lib.${it.substringAfterLast(".")}") } } build { dependsOn(shadowJar) } jar { // enabled = false archiveFileName.set("${rootProject.name}.jar") } } fun gitCommit(): String { val os = ByteArrayOutputStream() project.exec { isIgnoreExitValue = true commandLine = "git rev-parse --short HEAD".split(" ") standardOutput = os } return "git-" + String(os.toByteArray()).trim() } fun download(link: String, path: String) { URL(link).openStream().use { input -> FileOutputStream(File(path)).use { output -> input.copyTo(output) } } }