2019-07-11 07:45:12 +08:00
|
|
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
2021-11-12 04:05:43 +08:00
|
|
|
import io.papermc.paperweight.userdev.attribute.Obfuscation
|
2019-07-11 07:45:12 +08:00
|
|
|
|
|
|
|
plugins {
|
|
|
|
`java-library`
|
|
|
|
}
|
|
|
|
|
|
|
|
applyPlatformAndCoreConfiguration()
|
|
|
|
applyShadowConfiguration()
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
maven { url = uri("https://hub.spigotmc.org/nexus/content/groups/public") }
|
|
|
|
maven { url = uri("https://papermc.io/repo/repository/maven-public/") }
|
|
|
|
}
|
|
|
|
|
2021-06-14 02:32:38 +08:00
|
|
|
val localImplementation = configurations.create("localImplementation") {
|
|
|
|
description = "Dependencies used locally, but provided by the runtime Bukkit implementation"
|
|
|
|
isCanBeConsumed = false
|
|
|
|
isCanBeResolved = false
|
|
|
|
}
|
|
|
|
configurations["compileOnly"].extendsFrom(localImplementation)
|
|
|
|
configurations["testImplementation"].extendsFrom(localImplementation)
|
|
|
|
|
2021-10-02 12:11:29 +08:00
|
|
|
val adapters = configurations.create("adapters") {
|
|
|
|
description = "Adapters to include in the JAR"
|
|
|
|
isCanBeConsumed = false
|
|
|
|
isCanBeResolved = true
|
|
|
|
shouldResolveConsistentlyWith(configurations["runtimeClasspath"])
|
|
|
|
attributes {
|
2021-11-12 04:05:43 +08:00
|
|
|
attribute(Obfuscation.OBFUSCATION_ATTRIBUTE, objects.named(Obfuscation.OBFUSCATED))
|
2021-10-02 12:11:29 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-11 07:45:12 +08:00
|
|
|
dependencies {
|
|
|
|
"api"(project(":worldedit-core"))
|
|
|
|
"api"(project(":worldedit-libs:bukkit"))
|
2021-06-14 02:32:38 +08:00
|
|
|
// Technically this is api, but everyone should already have some form of the bukkit API
|
|
|
|
// Avoid pulling in another one, especially one so outdated.
|
2021-06-23 05:13:47 +08:00
|
|
|
"localImplementation"("org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT") {
|
2019-07-16 07:07:11 +08:00
|
|
|
exclude("junit", "junit")
|
|
|
|
}
|
2021-03-29 11:35:48 +08:00
|
|
|
|
2021-12-13 07:49:32 +08:00
|
|
|
"localImplementation"(platform("org.apache.logging.log4j:log4j-bom:${Versions.LOG4J}") {
|
2021-03-29 11:35:48 +08:00
|
|
|
because("Spigot provides Log4J (sort of, not in API, implicitly part of server)")
|
|
|
|
})
|
2021-06-14 02:32:38 +08:00
|
|
|
"localImplementation"("org.apache.logging.log4j:log4j-api")
|
2021-03-29 11:35:48 +08:00
|
|
|
|
2021-01-25 18:14:09 +08:00
|
|
|
"compileOnly"("org.jetbrains:annotations:20.1.0")
|
2021-06-23 05:13:47 +08:00
|
|
|
"compileOnly"("io.papermc.paper:paper-api:1.17-R0.1-SNAPSHOT") {
|
2022-06-10 08:21:11 +08:00
|
|
|
exclude("org.slf4j", "slf4j-api")
|
|
|
|
exclude("junit", "junit")
|
2021-03-29 11:35:48 +08:00
|
|
|
}
|
2021-12-01 00:53:14 +08:00
|
|
|
"implementation"("io.papermc:paperlib:1.0.7")
|
2019-07-11 07:45:12 +08:00
|
|
|
"compileOnly"("com.sk89q:dummypermscompat:1.10")
|
2022-01-30 02:02:42 +08:00
|
|
|
"implementation"("org.bstats:bstats-bukkit:2.2.1")
|
2021-01-25 18:14:09 +08:00
|
|
|
"implementation"("it.unimi.dsi:fastutil")
|
2020-07-16 09:48:47 +08:00
|
|
|
"testImplementation"("org.mockito:mockito-core:1.9.0-rc1")
|
2021-10-02 12:11:29 +08:00
|
|
|
|
|
|
|
project.project(":worldedit-bukkit:adapters").subprojects.forEach {
|
|
|
|
"adapters"(project(it.path))
|
|
|
|
}
|
2019-07-11 07:45:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.named<Copy>("processResources") {
|
2020-11-03 10:16:23 +08:00
|
|
|
val internalVersion = project.ext["internalVersion"]
|
|
|
|
inputs.property("internalVersion", internalVersion)
|
2019-07-11 07:45:12 +08:00
|
|
|
filesMatching("plugin.yml") {
|
2020-11-03 10:16:23 +08:00
|
|
|
expand("internalVersion" to internalVersion)
|
2019-07-11 07:45:12 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-23 14:05:23 +08:00
|
|
|
addJarManifest(WorldEditKind.Plugin, includeClasspath = true)
|
2019-07-11 07:45:12 +08:00
|
|
|
|
|
|
|
tasks.named<ShadowJar>("shadowJar") {
|
2021-10-02 12:11:29 +08: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-23 06:00:02 +08:00
|
|
|
})
|
2019-07-11 07:45:12 +08:00
|
|
|
dependencies {
|
2021-03-29 11:35:48 +08:00
|
|
|
// In tandem with not bundling log4j, we shouldn't relocate base package here.
|
|
|
|
// relocate("org.apache.logging", "com.sk89q.worldedit.log4j")
|
2019-10-19 15:48:49 +08:00
|
|
|
relocate("org.antlr.v4", "com.sk89q.worldedit.antlr4")
|
2021-03-29 11:35:48 +08: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-10-19 15:48:49 +08:00
|
|
|
include(dependency("org.antlr:antlr4-runtime"))
|
2022-05-22 15:02:35 +08:00
|
|
|
include(dependency("org.bstats:"))
|
|
|
|
include(dependency("io.papermc:paperlib"))
|
|
|
|
include(dependency("it.unimi.dsi:fastutil"))
|
|
|
|
|
|
|
|
relocate("org.bstats", "com.sk89q.worldedit.bstats")
|
|
|
|
relocate("io.papermc.lib", "com.sk89q.worldedit.bukkit.paperlib")
|
|
|
|
relocate("it.unimi.dsi.fastutil", "com.sk89q.worldedit.bukkit.fastutil")
|
2019-07-11 07:45:12 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.named("assemble").configure {
|
|
|
|
dependsOn("shadowJar")
|
|
|
|
}
|
2021-06-14 02:32:38 +08:00
|
|
|
|
|
|
|
configure<PublishingExtension> {
|
|
|
|
publications.named<MavenPublication>("maven") {
|
|
|
|
from(components["java"])
|
|
|
|
}
|
|
|
|
}
|