DLib/build.gradle.kts

92 lines
2.3 KiB
Kotlin

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.8.22"
kotlin("plugin.serialization") version "1.8.22"
id("maven-publish")
id("com.github.johnrengelman.shadow") version "8.1.1"
id("io.papermc.paperweight.userdev") version "1.5.5"
}
group = "nl.kallestruik"
version = "1.5.1"
repositories {
mavenCentral()
}
dependencies {
paperweight.paperDevBundle("1.20-R0.1-SNAPSHOT")
implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
implementation("org.jetbrains.kotlin:kotlin-scripting-common")
implementation("org.jetbrains.kotlin:kotlin-scripting-jvm")
implementation("org.jetbrains.kotlin:kotlin-scripting-jvm-host")
implementation("net.kyori:adventure-text-serializer-plain:4.14.0")
testImplementation(kotlin("test-junit5"))
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2")
}
tasks {
build {
dependsOn(shadowJar)
}
assemble {
dependsOn(reobfJar)
}
test {
useJUnitPlatform()
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
processResources {
expand("version" to project.version)
}
}
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
publishing {
publications {
create<MavenPublication>("release") {
from(components["kotlin"])
artifact(sourcesJar)
}
}
repositories {
maven {
url = uri(System.getenv("MAVEN_REPO_URL") ?: "")
credentials(HttpHeaderCredentials::class) {
name = "Authorization"
value = "token ${System.getenv("MAVEN_REPO_TOKEN")}"
}
authentication {
create<HttpHeaderAuthentication>("Authentication Header")
}
}
}
}
kotlin {
sourceSets {
all {
languageSettings.optIn("kotlin.RequiresOptIn")
languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi")
}
}
}