WorldEdit/worldedit-bukkit/build.gradle.kts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

111 lines
4.0 KiB
Plaintext
Raw Normal View History

2019-07-11 07:45:12 +08:00
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
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/") }
}
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)
val adapters = configurations.create("adapters") {
description = "Adapters to include in the JAR"
isCanBeConsumed = false
isCanBeResolved = true
shouldResolveConsistentlyWith(configurations["runtimeClasspath"])
attributes {
attribute(Obfuscation.OBFUSCATION_ATTRIBUTE, objects.named(Obfuscation.OBFUSCATED))
}
}
2019-07-11 07:45:12 +08:00
dependencies {
"api"(project(":worldedit-core"))
"api"(project(":worldedit-libs:bukkit"))
// Technically this is api, but everyone should already have some form of the bukkit API
// Avoid pulling in another one, especially one so outdated.
"localImplementation"("org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT") {
2019-07-16 07:07:11 +08:00
exclude("junit", "junit")
}
"localImplementation"(platform("org.apache.logging.log4j:log4j-bom:${Versions.LOG4J}") {
because("Spigot provides Log4J (sort of, not in API, implicitly part of server)")
})
"localImplementation"("org.apache.logging.log4j:log4j-api")
"compileOnly"("org.jetbrains:annotations:20.1.0")
"compileOnly"("io.papermc.paper:paper-api:1.17-R0.1-SNAPSHOT") {
exclude("org.slf4j", "slf4j-api")
exclude("junit", "junit")
}
"implementation"("io.papermc:paperlib:1.0.7")
2019-07-11 07:45:12 +08:00
"compileOnly"("com.sk89q:dummypermscompat:1.10")
"implementation"("org.bstats:bstats-bukkit:2.2.1")
"implementation"("it.unimi.dsi:fastutil")
"testImplementation"("org.mockito:mockito-core:1.9.0-rc1")
project.project(":worldedit-bukkit:adapters").subprojects.forEach {
"adapters"(project(it.path))
}
2019-07-11 07:45:12 +08:00
}
tasks.named<Copy>("processResources") {
val internalVersion = project.ext["internalVersion"]
inputs.property("internalVersion", internalVersion)
2019-07-11 07:45:12 +08:00
filesMatching("plugin.yml") {
expand("internalVersion" to internalVersion)
2019-07-11 07:45:12 +08:00
}
}
addJarManifest(WorldEditKind.Plugin, includeClasspath = true)
2019-07-11 07:45:12 +08:00
tasks.named<ShadowJar>("shadowJar") {
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 {
// 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")
// 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"))
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")
}
configure<PublishingExtension> {
publications.named<MavenPublication>("maven") {
from(components["java"])
}
}