FastAsyncWorldEdit/worldedit-fabric/build.gradle.kts
Octavia Togami 8b1f043dc5 Update so many dependencies, merge Forge/Fabric for final jar (#1651)
* Update so many dependencies, merge Forge/Fabric for final

* Clean up contrib docs for Gradle change

* Fix setting compat flags while using toolchain

* Fix deprecation in doc printer

* Restore proper forge JAR name

* Add dist classifier for mod jar

* Properly relocate new bStats

* Fix jar used from fabric

* Fix fabric bom

* Dup the shaded classes for consistency

* Sync Forge/Fabric log4j versions, de-dup

* Downgrade both log4j. This will work

* Update some plugins as well

* Drop the fabric force stuff

* Use duplicate strategy to directly merge jar
2021-02-04 17:45:49 -05:00

108 Zeilen
3.3 KiB
Plaintext

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.fabricmc.loom.task.RemapJarTask
applyPlatformAndCoreConfiguration()
applyShadowConfiguration()
apply(plugin = "fabric-loom")
apply(plugin = "java-library")
val minecraftVersion = "1.15.2"
val yarnMappings = "1.15.2+build.14:v2"
val loaderVersion = "0.7.8+build.189"
configurations.all {
resolutionStrategy {
force("com.google.guava:guava:21.0")
}
}
dependencies {
"api"(project(":worldedit-core"))
"implementation"(enforcedPlatform("org.apache.logging.log4j:log4j-bom:2.8.1") {
because("Mojang provides Log4J, we bump to match Forge")
})
"implementation"("org.apache.logging.log4j:log4j-slf4j-impl")
"minecraft"("com.mojang:minecraft:$minecraftVersion")
"mappings"("net.fabricmc:yarn:$yarnMappings")
"modCompile"("net.fabricmc:fabric-loader:$loaderVersion")
listOf(
"net.fabricmc.fabric-api:fabric-api-base:0.1.2+28f8190f42",
"net.fabricmc.fabric-api:fabric-events-interaction-v0:0.2.6+12515ed975",
"net.fabricmc.fabric-api:fabric-events-lifecycle-v0:0.1.2+b7f9825de8",
"net.fabricmc.fabric-api:fabric-networking-v0:0.1.7+12515ed975"
).forEach {
"include"(it)
"modImplementation"(it)
}
// Hook these up manually, because Fabric doesn't seem to quite do it properly.
"compileClasspath"("net.fabricmc:sponge-mixin:${project.versions.mixin}")
"annotationProcessor"("net.fabricmc:sponge-mixin:${project.versions.mixin}")
"annotationProcessor"("net.fabricmc:fabric-loom:${project.versions.loom}")
"testCompile"("org.mockito:mockito-core:1.9.0-rc1")
}
configure<BasePluginConvention> {
archivesBaseName = "$archivesBaseName-mc$minecraftVersion"
}
tasks.named<Copy>("processResources") {
// this will ensure that this task is redone when the versions change.
inputs.property("version", project.ext["internalVersion"])
from(sourceSets["main"].resources.srcDirs) {
include("fabric.mod.json")
expand("version" to project.ext["internalVersion"])
}
// copy everything else except the mod json
from(sourceSets["main"].resources.srcDirs) {
exclude("fabric.mod.json")
}
}
tasks.named<Jar>("jar") {
manifest {
attributes("Class-Path" to CLASSPATH,
"WorldEdit-Version" to project.version)
}
}
tasks.named<ShadowJar>("shadowJar") {
archiveClassifier.set("dist-dev")
dependencies {
relocate("org.slf4j", "com.sk89q.worldedit.slf4j")
relocate("org.apache.logging.slf4j", "com.sk89q.worldedit.l4j")
relocate("org.antlr.v4", "com.sk89q.worldedit.antlr4")
include(dependency("org.slf4j:slf4j-api"))
include(dependency("org.apache.logging.log4j:log4j-slf4j-impl"))
include(dependency("org.antlr:antlr4-runtime"))
}
}
tasks.register<Jar>("deobfJar") {
from(sourceSets["main"].output)
archiveClassifier.set("dev")
}
artifacts {
add("archives", tasks.named("deobfJar"))
}
tasks.register<RemapJarTask>("remapShadowJar") {
val shadowJar = tasks.getByName<ShadowJar>("shadowJar")
dependsOn(shadowJar)
input.set(shadowJar.archiveFile)
archiveFileName.set(shadowJar.archiveFileName.get().replace(Regex("-dev\\.jar$"), ".jar"))
addNestedDependencies.set(true)
}
tasks.named("assemble").configure {
dependsOn("remapShadowJar")
}