DLib/build.gradle.kts

90 lines
2.2 KiB
Kotlin

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.7.0"
kotlin("plugin.serialization") version "1.7.0"
id("maven-publish")
id("com.github.johnrengelman.shadow") version "7.1.2"
id("io.papermc.paperweight.userdev") version "1.3.5"
}
group = "nl.kallestruik"
version = "1.5.0"
repositories {
mavenCentral()
}
dependencies {
paperDevBundle("1.19-R0.1-SNAPSHOT")
implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0")
implementation("org.jetbrains.kotlin:kotlin-scripting-common")
implementation("org.jetbrains.kotlin:kotlin-scripting-jvm")
implementation("org.jetbrains.kotlin:kotlin-scripting-jvm-host")
testImplementation(kotlin("test-junit5"))
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.6.0")
}
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")
}
}
}