import java.io.FileOutputStream import java.net.URL import java.io.ByteArrayOutputStream plugins { id("java") id("java-library") id("com.github.johnrengelman.shadow") version "8.1.1" id("maven-publish") } allprojects { group = "com.alttd.essentia" version = "Build-" + (System.getenv("BUILD_NUMBER") ?: gitCommit()) description = "Altitude essentials ;)" } subprojects { apply() apply(plugin = "maven-publish") java { toolchain { languageVersion.set(JavaLanguageVersion.of(17)) } } 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") } } dependencies { compileOnly("com.alttd:Comet-API:1.20.4-R0.1-SNAPSHOT") } 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) } } }