2021-06-26 14:52:25 +00:00
|
|
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
2021-07-05 22:49:07 +00:00
|
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
2021-07-04 11:58:19 +00:00
|
|
|
import org.yaml.snakeyaml.Yaml
|
|
|
|
import java.io.File
|
|
|
|
import java.io.FileInputStream
|
2021-06-26 14:52:25 +00:00
|
|
|
|
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
2021-07-03 19:41:29 +00:00
|
|
|
maven("https://plugins.gradle.org/m2/")
|
2021-06-26 14:52:25 +00:00
|
|
|
}
|
|
|
|
dependencies {
|
2021-07-03 19:41:29 +00:00
|
|
|
classpath("org.yaml:snakeyaml:1.26")
|
|
|
|
classpath("org.jlleitschuh.gradle:ktlint-gradle:10.1.0")
|
2021-06-26 14:52:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
id("org.jetbrains.kotlin.jvm") version "1.4.31"
|
|
|
|
id("com.github.johnrengelman.shadow") version "5.2.0"
|
2021-07-04 08:24:28 +00:00
|
|
|
id("org.jlleitschuh.gradle.ktlint") version "10.1.0"
|
2021-06-26 14:52:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
group = "org.kraftwerk28"
|
|
|
|
|
2021-07-03 19:41:29 +00:00
|
|
|
val cfg: Map<String, String> = Yaml()
|
|
|
|
.load(FileInputStream("$projectDir/src/main/resources/plugin.yml"))
|
2021-06-26 14:52:25 +00:00
|
|
|
val pluginVersion = cfg.get("version")
|
|
|
|
val spigotApiVersion = cfg.get("api-version")
|
2021-07-05 22:49:07 +00:00
|
|
|
val retrofitVersion = "2.7.1"
|
2021-06-26 14:52:25 +00:00
|
|
|
version = pluginVersion as Any
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
maven(
|
|
|
|
url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
|
|
|
|
)
|
|
|
|
maven(url = "https://jitpack.io")
|
|
|
|
maven(url = "https://oss.sonatype.org/content/repositories/snapshots/")
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
|
|
|
compileOnly("org.spigotmc:spigot-api:$spigotApiVersion-R0.1-SNAPSHOT")
|
2021-06-29 15:40:58 +00:00
|
|
|
implementation("com.google.code.gson:gson:2.8.7")
|
|
|
|
implementation("com.squareup.retrofit2:retrofit:$retrofitVersion")
|
|
|
|
implementation("com.squareup.retrofit2:converter-gson:$retrofitVersion")
|
|
|
|
implementation("com.squareup.okhttp3:logging-interceptor:4.2.1")
|
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0")
|
2021-06-26 14:52:25 +00:00
|
|
|
implementation("com.vdurmont:emoji-java:5.1.1")
|
|
|
|
}
|
|
|
|
|
2021-07-04 08:24:28 +00:00
|
|
|
defaultTasks("shadowJar")
|
|
|
|
|
|
|
|
tasks {
|
|
|
|
named<ShadowJar>("shadowJar") {
|
|
|
|
archiveFileName.set(
|
2021-07-04 11:58:19 +00:00
|
|
|
"spigot-tg-bridge-$spigotApiVersion-v$pluginVersion.jar"
|
2021-07-04 08:24:28 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
register<Copy>("copyArtifacts") {
|
2021-07-05 22:49:07 +00:00
|
|
|
val dest = File(
|
|
|
|
System.getProperty("user.home"),
|
|
|
|
"MinecraftServers/spigot_1.17/plugins/",
|
|
|
|
)
|
|
|
|
from(shadowJar)
|
|
|
|
into(dest)
|
2021-07-04 08:24:28 +00:00
|
|
|
}
|
|
|
|
register("pack") {
|
|
|
|
description = "[For development only!] Build project and copy .jar into servers directory"
|
|
|
|
dependsOn("shadowJar")
|
|
|
|
finalizedBy("copyArtifacts")
|
|
|
|
}
|
2021-07-05 22:49:07 +00:00
|
|
|
withType<KotlinCompile> {
|
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = "1.8"
|
|
|
|
}
|
|
|
|
}
|
2021-06-26 14:52:25 +00:00
|
|
|
}
|