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`
|
2023-08-02 12:07:19 +00:00
|
|
|
id("com.modrinth.minotaur") version "2.8.3"
|
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
|
|
|
}
|
2023-06-02 12:21:16 +00:00
|
|
|
maven {
|
|
|
|
name = "Glaremasters"
|
|
|
|
url = uri("https://repo.glaremasters.me/repository/towny/")
|
|
|
|
}
|
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 {
|
2023-05-20 19:01:34 +00:00
|
|
|
attribute(Obfuscation.OBFUSCATION_ATTRIBUTE,
|
|
|
|
if ((project.findProperty("enginehub.obf.none") as String?).toBoolean()) {
|
|
|
|
objects.named(Obfuscation.NONE)
|
|
|
|
} else {
|
|
|
|
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.residence) { isTransitive = false }
|
2021-08-01 17:28:51 +00:00
|
|
|
compileOnly(libs.towny) { isTransitive = false }
|
2023-07-22 10:01:33 +00:00
|
|
|
compileOnly("com.intellectualsites.plotsquared:plotsquared-bukkit") { isTransitive = false }
|
|
|
|
compileOnly("com.intellectualsites.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")
|
2022-06-14 15:02:11 +00:00
|
|
|
implementation("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-06-14 15:02:11 +00:00
|
|
|
include(dependency("com.intellectualsites.paster:Paster"))
|
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") {
|
2023-07-22 10:01:33 +00:00
|
|
|
include(dependency("net.kyori:adventure-nbt:4.14.0"))
|
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")
|
|
|
|
}
|
2022-10-02 19:50:16 +00:00
|
|
|
|
|
|
|
tasks {
|
|
|
|
modrinth {
|
|
|
|
token.set(System.getenv("MODRINTH_TOKEN"))
|
|
|
|
projectId.set("fastasyncworldedit")
|
|
|
|
versionName.set("${project.version}")
|
|
|
|
versionNumber.set("${project.version}")
|
|
|
|
versionType.set("release")
|
|
|
|
uploadFile.set(file("build/libs/${rootProject.name}-Bukkit-${project.version}.jar"))
|
2023-06-29 10:23:26 +00:00
|
|
|
gameVersions.addAll(listOf("1.20.1", "1.20", "1.19.4", "1.18.2", "1.17.1", "1.16.5"))
|
2022-12-11 17:36:13 +00:00
|
|
|
loaders.addAll(listOf("paper", "spigot"))
|
2022-10-04 11:28:10 +00:00
|
|
|
changelog.set("The changelog is available on GitHub: https://github.com/IntellectualSites/" +
|
|
|
|
"FastAsyncWorldEdit/releases/tag/${project.version}")
|
2022-10-09 14:41:22 +00:00
|
|
|
syncBodyFrom.set(rootProject.file("README.md").readText())
|
2022-10-02 19:50:16 +00:00
|
|
|
}
|
|
|
|
}
|