101 lines
2.7 KiB
Kotlin
101 lines
2.7 KiB
Kotlin
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
|
|
plugins {
|
|
kotlin("jvm") version "1.7.0-RC"
|
|
id("com.github.johnrengelman.shadow") version "7.1.2"
|
|
id("io.papermc.paperweight.userdev") version "1.3.5"
|
|
id("xyz.jpenilla.run-paper") version "1.0.6" // Adds runServer and runMojangMappedServer tasks for testing
|
|
id("net.minecrell.plugin-yml.bukkit") version "0.5.1"
|
|
}
|
|
|
|
val projectGroup: String by project
|
|
val projectVersion: String by project
|
|
val mainPackage: String by project
|
|
val mainClass: String by project
|
|
|
|
val paperVersion: String by project
|
|
val acfVersion: String by project
|
|
val dlibVersion: String by project
|
|
|
|
group = projectGroup
|
|
version = projectVersion
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
mavenCentral()
|
|
|
|
maven("https://papermc.io/repo/repository/maven-public/")
|
|
maven("https://repo.aikar.co/content/groups/aikar/")
|
|
}
|
|
|
|
dependencies {
|
|
paperDevBundle(paperVersion)
|
|
|
|
implementation("co.aikar:acf-paper:$acfVersion")
|
|
implementation("nl.kallestruik:DLib:$dlibVersion")
|
|
|
|
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"))
|
|
}
|
|
|
|
// Use KSP Generated sources
|
|
sourceSets.main {
|
|
java.srcDirs("build/generated/ksp/main/kotlin")
|
|
}
|
|
|
|
|
|
tasks {
|
|
test {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
withType<JavaCompile> {
|
|
options.compilerArgs.add("-parameters")
|
|
options.isFork = true
|
|
options.forkOptions.executable = "javac"
|
|
|
|
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
|
|
|
|
// Set the release flag. This configures what version bytecode the compiler will emit, as well as what JDK APIs are usable.
|
|
// See https://openjdk.java.net/jeps/247 for more information.
|
|
options.release.set(17)
|
|
}
|
|
|
|
withType<KotlinCompile> {
|
|
kotlinOptions.jvmTarget = "1.8"
|
|
kotlinOptions.javaParameters = true
|
|
}
|
|
|
|
shadowJar {
|
|
relocate("co.aikar.commands", "$mainPackage.acf")
|
|
relocate("co.aikar.locales", "$mainPackage.locales")
|
|
}
|
|
|
|
withType<Javadoc> {
|
|
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
|
|
}
|
|
|
|
processResources {
|
|
filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything
|
|
}
|
|
|
|
assemble {
|
|
dependsOn(reobfJar)
|
|
}
|
|
}
|
|
|
|
|
|
// Configure plugin.yml generation
|
|
bukkit {
|
|
load = BukkitPluginDescription.PluginLoadOrder.STARTUP
|
|
main = "$mainPackage.$mainClass"
|
|
apiVersion = "1.18"
|
|
authors = listOf("Kalle \"dragontamerfred\" Struik")
|
|
commands {
|
|
register("ditems")
|
|
}
|
|
} |