2019-08-26 04:45:03 +00:00
|
|
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
2021-11-11 21:22:44 +00:00
|
|
|
import io.papermc.paperweight.userdev.attribute.Obfuscation
|
2019-08-26 04:45:03 +00:00
|
|
|
|
|
|
|
plugins {
|
2021-02-11 16:59:03 +00:00
|
|
|
`java-library`
|
2019-08-26 04:45:03 +00:00
|
|
|
}
|
|
|
|
|
2021-07-01 20:16:25 +00:00
|
|
|
project.description = "Bukkit"
|
|
|
|
|
2019-08-26 04:45:03 +00:00
|
|
|
applyPlatformAndCoreConfiguration()
|
|
|
|
applyShadowConfiguration()
|
|
|
|
|
|
|
|
repositories {
|
2021-01-21 12:07:17 +00:00
|
|
|
maven {
|
2021-01-21 12:34:33 +00:00
|
|
|
name = "PaperMC"
|
2022-05-21 10:08:10 +00:00
|
|
|
url = uri("https://repo.papermc.io/repository/maven-public/")
|
2021-07-01 20:16:25 +00:00
|
|
|
}
|
2021-01-21 12:07:17 +00:00
|
|
|
maven {
|
2021-01-21 12:34:33 +00:00
|
|
|
name = "EngineHub"
|
2021-01-21 12:07:17 +00:00
|
|
|
url = uri("https://maven.enginehub.org/repo/")
|
2021-07-01 20:16:25 +00:00
|
|
|
}
|
2020-08-14 19:29:15 +00:00
|
|
|
maven {
|
2021-01-21 12:34:33 +00:00
|
|
|
name = "JitPack"
|
|
|
|
url = uri("https://jitpack.io")
|
2021-07-01 20:16:25 +00:00
|
|
|
}
|
2022-01-23 17:29:01 +00:00
|
|
|
maven {
|
|
|
|
name = "GriefDefender"
|
|
|
|
url = uri("https://repo.glaremasters.me/repository/bloodshot/")
|
|
|
|
}
|
2021-02-22 10:04:12 +00:00
|
|
|
maven {
|
2021-02-27 14:52:50 +00:00
|
|
|
name = "OSS Sonatype Snapshots"
|
2021-02-22 10:04:12 +00:00
|
|
|
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
|
2021-07-01 20:16:25 +00:00
|
|
|
}
|
2021-01-21 12:07:17 +00:00
|
|
|
flatDir { dir(File("src/main/resources")) }
|
2019-08-26 04:45:03 +00:00
|
|
|
}
|
|
|
|
|
2021-09-22 21:00:12 +00:00
|
|
|
val localImplementation = configurations.create("localImplementation") {
|
|
|
|
description = "Dependencies used locally, but provided by the runtime Bukkit implementation"
|
|
|
|
isCanBeConsumed = false
|
|
|
|
isCanBeResolved = false
|
|
|
|
}
|
|
|
|
|
2021-10-17 14:32:36 +00:00
|
|
|
val adapters = configurations.create("adapters") {
|
|
|
|
description = "Adapters to include in the JAR"
|
|
|
|
isCanBeConsumed = false
|
|
|
|
isCanBeResolved = true
|
|
|
|
shouldResolveConsistentlyWith(configurations["runtimeClasspath"])
|
|
|
|
attributes {
|
2021-11-11 21:22:44 +00:00
|
|
|
attribute(Obfuscation.OBFUSCATION_ATTRIBUTE, objects.named(Obfuscation.OBFUSCATED))
|
2021-10-17 14:32:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-26 04:45:03 +00:00
|
|
|
dependencies {
|
2021-08-01 17:28:51 +00:00
|
|
|
// Modules
|
|
|
|
api(projects.worldeditCore)
|
|
|
|
api(projects.worldeditLibs.bukkit)
|
|
|
|
|
2021-10-17 14:32:36 +00:00
|
|
|
project.project(":worldedit-bukkit:adapters").subprojects.forEach {
|
|
|
|
"adapters"(project(it.path))
|
|
|
|
}
|
|
|
|
|
2021-08-01 17:28:51 +00:00
|
|
|
// Minecraft expectations
|
|
|
|
implementation(libs.fastutil)
|
|
|
|
|
|
|
|
// Platform expectations
|
2022-06-09 23:26:48 +00:00
|
|
|
compileOnly("io.papermc.paper:paper-api") {
|
2019-08-26 04:45:03 +00:00
|
|
|
exclude("junit", "junit")
|
2021-03-29 13:29:16 +00:00
|
|
|
exclude(group = "org.slf4j", module = "slf4j-api")
|
2019-08-26 04:45:03 +00:00
|
|
|
}
|
2021-08-01 17:28:51 +00:00
|
|
|
|
|
|
|
// Logging
|
2022-06-09 23:26:48 +00:00
|
|
|
localImplementation("org.apache.logging.log4j:log4j-api")
|
2021-09-22 21:00:12 +00:00
|
|
|
localImplementation(libs.log4jBom) {
|
2021-03-29 13:29:16 +00:00
|
|
|
because("Spigot provides Log4J (sort of, not in API, implicitly part of server)")
|
2021-08-01 17:28:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Plugins
|
2022-06-09 23:26:48 +00:00
|
|
|
compileOnly("com.github.MilkBowl:VaultAPI") { isTransitive = false }
|
2021-08-01 17:28:51 +00:00
|
|
|
compileOnly(libs.dummypermscompat) {
|
2020-08-14 19:29:15 +00:00
|
|
|
exclude("com.github.MilkBowl", "VaultAPI")
|
|
|
|
}
|
2021-08-01 17:28:51 +00:00
|
|
|
compileOnly(libs.worldguard) {
|
2019-09-02 19:22:43 +00:00
|
|
|
exclude("com.sk89q.worldedit", "worldedit-bukkit")
|
|
|
|
exclude("com.sk89q.worldedit", "worldedit-core")
|
|
|
|
exclude("com.sk89q.worldedit.worldedit-libs", "bukkit")
|
|
|
|
exclude("com.sk89q.worldedit.worldedit-libs", "core")
|
|
|
|
}
|
2021-09-22 21:00:12 +00:00
|
|
|
compileOnly(libs.mapmanager) { isTransitive = false }
|
|
|
|
compileOnly(libs.griefprevention) { isTransitive = false }
|
|
|
|
compileOnly(libs.griefdefender) { isTransitive = false }
|
|
|
|
compileOnly(libs.mcore) { isTransitive = false }
|
|
|
|
compileOnly(libs.residence) { isTransitive = false }
|
2021-08-01 17:28:51 +00:00
|
|
|
compileOnly(libs.towny) { isTransitive = false }
|
2022-06-09 23:26:48 +00:00
|
|
|
compileOnly("com.plotsquared:PlotSquared-Bukkit") { isTransitive = false }
|
|
|
|
compileOnly("com.plotsquared:PlotSquared-Core") { isTransitive = false }
|
2021-08-01 17:28:51 +00:00
|
|
|
|
2020-09-16 14:10:00 +00:00
|
|
|
// Third party
|
2022-06-09 23:26:48 +00:00
|
|
|
implementation("io.papermc:paperlib")
|
|
|
|
implementation("org.bstats:bstats-bukkit") { isTransitive = false }
|
2021-09-24 14:49:30 +00:00
|
|
|
implementation(libs.bstatsBase) { isTransitive = false }
|
2022-06-09 23:26:48 +00:00
|
|
|
implementation("dev.notmyfault.serverlib:ServerLib")
|
|
|
|
api("com.intellectualsites.paster:Paster") { isTransitive = false }
|
2021-09-24 14:49:30 +00:00
|
|
|
api(libs.lz4Java) { isTransitive = false }
|
2021-08-01 17:28:51 +00:00
|
|
|
api(libs.sparsebitset) { isTransitive = false }
|
|
|
|
api(libs.parallelgzip) { isTransitive = false }
|
2022-06-09 23:26:48 +00:00
|
|
|
compileOnly("net.kyori:adventure-api")
|
|
|
|
compileOnlyApi("org.checkerframework:checker-qual")
|
2021-08-01 17:28:51 +00:00
|
|
|
|
|
|
|
// Tests
|
|
|
|
testImplementation(libs.mockito)
|
2022-06-09 23:26:48 +00:00
|
|
|
testImplementation("net.kyori:adventure-api")
|
|
|
|
testImplementation("org.checkerframework:checker-qual")
|
|
|
|
testImplementation("io.papermc.paper:paper-api") { isTransitive = true }
|
2019-08-26 04:45:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.named<Copy>("processResources") {
|
2021-02-11 16:59:03 +00:00
|
|
|
val internalVersion = project.ext["internalVersion"]
|
|
|
|
inputs.property("internalVersion", internalVersion)
|
2019-08-26 04:45:03 +00:00
|
|
|
filesMatching("plugin.yml") {
|
2021-02-11 16:59:03 +00:00
|
|
|
expand("internalVersion" to internalVersion)
|
2019-08-26 04:45:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-16 11:00:12 +00:00
|
|
|
tasks.named<Jar>("jar") {
|
|
|
|
manifest {
|
|
|
|
attributes("Class-Path" to CLASSPATH,
|
|
|
|
"WorldEdit-Version" to project.version)
|
|
|
|
}
|
|
|
|
}
|
2019-08-26 04:45:03 +00:00
|
|
|
|
2021-02-25 21:58:17 +00:00
|
|
|
addJarManifest(WorldEditKind.Plugin, includeClasspath = true)
|
|
|
|
|
2019-08-26 04:45:03 +00:00
|
|
|
tasks.named<ShadowJar>("shadowJar") {
|
2021-10-17 14:32:36 +00:00
|
|
|
dependsOn(project.project(":worldedit-bukkit:adapters").subprojects.map { it.tasks.named("assemble") })
|
|
|
|
from(Callable {
|
|
|
|
adapters.resolve()
|
|
|
|
.map { f ->
|
|
|
|
zipTree(f).matching {
|
|
|
|
exclude("META-INF/")
|
|
|
|
}
|
|
|
|
}
|
2020-03-22 22:00:02 +00:00
|
|
|
})
|
2021-07-01 20:16:25 +00:00
|
|
|
archiveFileName.set("${rootProject.name}-Bukkit-${project.version}.${archiveExtension.getOrElse("jar")}")
|
2019-08-26 04:45:03 +00:00
|
|
|
dependencies {
|
2021-03-29 13:29:16 +00:00
|
|
|
// In tandem with not bundling log4j, we shouldn't relocate base package here.
|
|
|
|
// relocate("org.apache.logging", "com.sk89q.worldedit.log4j")
|
2019-11-19 21:25:36 +00:00
|
|
|
relocate("org.antlr.v4", "com.sk89q.worldedit.antlr4")
|
2019-08-26 04:45:03 +00:00
|
|
|
include(dependency(":worldedit-core"))
|
|
|
|
include(dependency(":worldedit-libs:bukkit"))
|
2021-03-29 13:29:16 +00:00
|
|
|
// Purposefully not included, we assume (even though no API exposes it) that Log4J will be present at runtime
|
|
|
|
// If it turns out not to be true for Spigot/Paper, our only two official platforms, this can be uncommented.
|
|
|
|
// include(dependency("org.apache.logging.log4j:log4j-api"))
|
2019-11-19 21:25:36 +00:00
|
|
|
include(dependency("org.antlr:antlr4-runtime"))
|
2021-09-17 13:38:28 +00:00
|
|
|
// ZSTD does not work if relocated. https://github.com/luben/zstd-jni/issues/189 Use not latest as it can be difficult
|
|
|
|
// to obtain latest ZSTD lib
|
|
|
|
include(dependency("com.github.luben:zstd-jni:1.4.8-1"))
|
2021-02-11 16:59:03 +00:00
|
|
|
relocate("org.bstats", "com.sk89q.worldedit.bstats") {
|
|
|
|
include(dependency("org.bstats:"))
|
2021-02-01 14:23:47 +00:00
|
|
|
}
|
2019-08-26 04:45:03 +00:00
|
|
|
relocate("io.papermc.lib", "com.sk89q.worldedit.bukkit.paperlib") {
|
2021-02-11 16:59:03 +00:00
|
|
|
include(dependency("io.papermc:paperlib"))
|
2019-08-26 04:45:03 +00:00
|
|
|
}
|
2021-07-24 13:12:59 +00:00
|
|
|
relocate("it.unimi.dsi.fastutil", "com.sk89q.worldedit.bukkit.fastutil") {
|
|
|
|
include(dependency("it.unimi.dsi:fastutil"))
|
|
|
|
}
|
2021-07-01 20:16:25 +00:00
|
|
|
relocate("org.incendo.serverlib", "com.fastasyncworldedit.serverlib") {
|
2021-10-04 15:13:41 +00:00
|
|
|
include(dependency("dev.notmyfault.serverlib:ServerLib:2.3.1"))
|
2021-01-24 11:01:03 +00:00
|
|
|
}
|
2021-07-01 20:16:25 +00:00
|
|
|
relocate("com.intellectualsites.paster", "com.fastasyncworldedit.paster") {
|
2022-01-28 21:15:24 +00:00
|
|
|
include(dependency("com.intellectualsites.paster:Paster:1.1.4"))
|
2020-12-19 16:18:57 +00:00
|
|
|
}
|
2021-07-01 20:16:25 +00:00
|
|
|
relocate("org.lz4", "com.fastasyncworldedit.core.lz4") {
|
2021-06-19 08:17:43 +00:00
|
|
|
include(dependency("org.lz4:lz4-java:1.8.0"))
|
2021-05-30 21:49:46 +00:00
|
|
|
}
|
2021-07-01 20:16:25 +00:00
|
|
|
relocate("net.kyori", "com.fastasyncworldedit.core.adventure") {
|
2022-03-14 15:14:10 +00:00
|
|
|
include(dependency("net.kyori:adventure-nbt:4.9.3"))
|
2021-07-01 20:16:25 +00:00
|
|
|
}
|
2021-07-23 15:48:51 +00:00
|
|
|
relocate("com.zaxxer", "com.fastasyncworldedit.core.math") {
|
|
|
|
include(dependency("com.zaxxer:SparseBitSet:1.2"))
|
|
|
|
}
|
|
|
|
relocate("org.anarres", "com.fastasyncworldedit.core.internal.io") {
|
|
|
|
include(dependency("org.anarres:parallelgzip:1.0.5"))
|
|
|
|
}
|
2019-08-26 04:45:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.named("assemble").configure {
|
|
|
|
dependsOn("shadowJar")
|
|
|
|
}
|