elevate-spigot/eSpigot-Server/build.gradle.kts

169 lines
5.6 KiB
Plaintext
Raw Normal View History

2022-06-24 22:53:07 +02:00
import java.util.Date
import java.text.SimpleDateFormat
plugins {
java
`java-library`
id("com.github.johnrengelman.shadow") version "7.1.0"
}
repositories {
mavenCentral()
2022-07-26 06:25:23 +02:00
mavenLocal()
2022-06-24 22:53:07 +02:00
gradlePluginPortal()
maven(url = "https://libraries.minecraft.net")
maven(url = "https://oss.sonatype.org/content/groups/public")
maven(url = "https://hub.spigotmc.org/nexus/content/groups/public")
maven(url = "https://repo.velocitypowered.com/snapshots/")
2022-08-01 12:56:36 +02:00
maven(url = "https://repo.viaversion.com")
2022-06-24 22:53:07 +02:00
}
val minecraftVersion = "1_8_R3"
group = "com.elevatemc.espigot"
version = "1.8.8-R0.1-SNAPSHOT"
repositories {
maven(url = "https://libraries.minecraft.net")
}
dependencies {
implementation(project(":espigot-api"))
implementation("io.netty:netty-all:4.1.69.Final") // eSpigot - Update Netty to 4.1.x
implementation("com.mojang:authlib:1.5.21")
implementation("org.apache.logging.log4j:log4j-api:2.17.2")
implementation("org.apache.logging.log4j:log4j-core:2.17.2")
implementation("org.apache.commons:commons-lang3:3.12.0")
implementation("commons-io:commons-io:2.4")
implementation("commons-codec:commons-codec:1.9")
implementation("com.google.guava:guava:31.1-jre")
implementation("com.google.code.gson:gson:2.2.4")
implementation("net.sf.trove4j:trove4j:3.0.3")
implementation("net.sf.jopt-simple:jopt-simple:3.2")
implementation("org.xerial:sqlite-jdbc:3.7.2")
implementation("mysql:mysql-connector-java:5.1.14")
implementation("net.minecrell:terminalconsoleappender:1.3.0")
implementation("org.jline:jline-terminal-jansi:3.20.0")
implementation("it.unimi.dsi:fastutil:8.5.8")
implementation("com.velocitypowered:velocity-native:1.1.0-SNAPSHOT")
implementation("org.lz4:lz4-java:1.8.0")
implementation("com.github.luben:zstd-jni:1.5.2-3")
implementation("net.openhft:affinity:3.20.0")
implementation("net.jafama:jafama:2.3.2")
implementation("com.eatthepath:fast-uuid:0.2.0")
2022-06-24 22:53:07 +02:00
testImplementation("junit:junit:4.11")
testImplementation("org.hamcrest:hamcrest-library:1.3")
compileOnly("org.projectlombok:lombok:1.18.24")
annotationProcessor("org.projectlombok:lombok:1.18.24")
2022-07-26 06:25:23 +02:00
implementation("net.kyori:adventure-text-serializer-gson-legacy-impl:4.9.3")
implementation("net.kyori:adventure-api:4.9.3")
implementation("net.kyori:adventure-text-serializer-legacy:4.7.0")
implementation("com.viaversion:opennbt:2.0-SNAPSHOT")
implementation("space.vectrix.flare:flare-fastutil:1.0.0")
implementation("javassist:javassist:3.11.0.GA")
2022-06-24 22:53:07 +02:00
}
fun TaskContainer.registerRunTask(
name: String, block: JavaExec.() -> Unit
): TaskProvider<JavaExec> = register<JavaExec>(name) {
group = "espigot"
standardInput = System.`in`
workingDir = rootProject.layout.projectDirectory.dir(
providers.gradleProperty("runWorkDir").forUseAtConfigurationTime().orElse("run")
).get().asFile
if (project.hasProperty("disableWatchdog")) {
systemProperty("disable.watchdog", true)
}
doFirst {
workingDir.mkdirs()
}
block(this)
}
tasks {
withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
val prepareTestServerDir by registering {
doLast {
mkdir("$buildDir/test-server")
}
}
test {
workingDir = file("$buildDir/test-server/")
dependsOn(prepareTestServerDir)
}
shadowJar {
mergeServiceFiles()
append("META-INF/io.netty.versions.properties")
transform(com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer()) // eSpigot - Use TerminalConsoleAppender
archiveBaseName.set("espigot")
archiveClassifier.set("") // without "-all"
val cbLibsPkg = "org.bukkit.craftbukkit.libs"
relocate("joptsimple", "$cbLibsPkg.joptsimple")
relocate("jline", "$cbLibsPkg.jline")
relocate("org.ibex", "$cbLibsPkg.org.ibex")
relocate("org.gjt", "$cbLibsPkg.org.gjt")
relocate("org.bukkit.craftbukkit", "org.bukkit.craftbukkit.v${minecraftVersion}") {
exclude("org.bukkit.craftbukkit.Main*") // don't relocate main class
}
relocate("net.minecraft.server", "net.minecraft.server.v${minecraftVersion}")
}
named("build") {
dependsOn(named("shadowJar"))
}
test {
exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class", "org/bukkit/craftbukkit/inventory/ItemFactoryTest.class")
}
jar {
manifest {
val date = SimpleDateFormat("yyyy-MM-dd-HH:mm:ss").format(Date())
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
"Implementation-Version" to "git-eSpigot-1.8.9",
"Implementation-Vendor" to date,
"Specification-Title" to "Bukkit",
"Specification-Version" to project.version,
"Specification-Vendor" to "Bukkit Team",
"Multi-Release" to true
)
}
}
registerRunTask("runShadow") {
description = "Spin up a test server from the shadowJar archiveFile"
classpath(shadowJar.flatMap { it.archiveFile })
}
registerRunTask("runDev") {
description = "Spin up a non-shaded non-relocated test server"
classpath = java.sourceSets.main.get().runtimeClasspath
mainClass.set("org.bukkit.craftbukkit.Main")
}
}