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
This commit is contained in:
Octavia Togami 2021-01-25 02:14:09 -08:00 committed by GitHub
parent b9cee6b988
commit 9534a9cfce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 146 additions and 103 deletions

View File

@ -1,8 +1,8 @@
Compiling
=========
You can compile WorldEdit as long as you have the [Java Development Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html) for Java 8 or newer.
You only need one version of the JDK installed.
You can compile WorldEdit as long as you have some version of Java greater than or equal to 8 installed. Gradle will download JDK 8 specifically if needed,
but it needs some version of Java to bootstrap from.
The build process uses Gradle, which you do *not* need to download. WorldEdit is a multi-module project with four modules:
@ -38,11 +38,6 @@ If you want to use WorldEdit, use the `-dist` version.
(The -dist version includes WorldEdit + necessary libraries.)
### Note regarding Forge builds
The build system used for forge (ForgeGradle) requires more memory than is usually given to Gradle by default.
If it fails, you should put `org.gradle.jvmargs=-Xmx3G` in `gradle.properties`.
Please don't commit this change!
## Other commands
* `gradlew idea` will generate an [IntelliJ IDEA](http://www.jetbrains.com/idea/) module for each folder.

View File

@ -23,7 +23,8 @@ Edit the Code
Want to add new features to WorldEdit or fix bugs yourself? You can get the game running, with WorldEdit, from the code here, without any additional outside steps, by doing the following *four* things:
1. Download WorldEdit's source code and put it somewhere. We recommend you use something called Git if you already know how to use it, but [you can also just download a .zip file](https://github.com/EngineHub/WorldEdit/archive/master.zip). (If you plan on contributing the changes, you will need to figure out Git.)
2. Install the [Java Development Kit (JDK) v8](https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html) and restart your computer for safe measure. You absolutely need version 8 of the JDK, even if you have other versions installed.
2. Install any version of Java greater than or equal to 8.
* Note that if you do _not_ install JDK 8 exactly, Gradle will download it for you on first run. However, it is still required to have some form of Java installed for Gradle to start at all.
3. Open terminal / command prompt / bash and navigate to the directory where you put the source code.
4. Run **one** of these following commands:
* Mac OS X / Linux: `./gradlew :worldedit-fabric:runClient`
@ -34,10 +35,6 @@ Want to add new features to WorldEdit or fix bugs yourself? You can get the game
When you make changes to the code, you have to restart the game by re-running the command for your changes to take effect. If there are errors in your Java syntax, the command will fail.
| Got an error? |
| :----------------------------------------------------------- |
| If you get a `Type javax.tools.JavaCompiler not present` error, you need to edit your environmental variables and add a new `JAVA_HOME` variable. The value of the variable needs to be the path to where JDK 8 was installed. |
For additional information about compiling WorldEdit, see [COMPILING.md](COMPILING.md).
### Using a Java IDE

View File

@ -26,17 +26,6 @@ repositories {
}
}
configurations.all {
resolutionStrategy {
// Fabric needs this.
force(
"commons-io:commons-io:2.6",
"org.ow2.asm:asm:8.0.1",
"org.ow2.asm:asm-commons:8.0.1"
)
}
}
val properties = Properties().also { props ->
project.projectDir.resolveSibling("gradle.properties").bufferedReader().use {
props.load(it)
@ -48,15 +37,14 @@ val mixinVersion: String = properties.getProperty("mixin.version")
dependencies {
implementation(gradleApi())
implementation("gradle.plugin.net.minecrell:licenser:0.4.1")
implementation("org.ajoberstar.grgit:grgit-gradle:4.0.2")
implementation("com.github.jengelman.gradle.plugins:shadow:5.2.0")
implementation("org.ajoberstar.grgit:grgit-gradle:4.1.0")
implementation("com.github.jengelman.gradle.plugins:shadow:6.1.0")
implementation("net.ltgt.apt-eclipse:net.ltgt.apt-eclipse.gradle.plugin:0.21")
implementation("net.ltgt.apt-idea:net.ltgt.apt-idea.gradle.plugin:0.21")
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.16.0")
implementation("gradle.plugin.org.spongepowered:spongegradle:0.9.0")
implementation("net.minecraftforge.gradle:ForgeGradle:3.0.181")
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.19.0")
implementation("org.spongepowered:SpongeGradle:0.11.5")
implementation("net.minecraftforge.gradle:ForgeGradle:4.0.9")
implementation("net.fabricmc:fabric-loom:$loomVersion")
implementation("net.fabricmc:sponge-mixin:$mixinVersion")
implementation("gradle.plugin.com.mendhak.gradlecrowdin:plugin:0.1.0")
implementation("org.enginehub.gradle:gradle-codecov-plugin:0.1.0")
}

View File

@ -1,8 +1,12 @@
import net.minecrell.gradle.licenser.LicenseExtension
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.repositories
import org.gradle.kotlin.dsl.the
fun Project.applyCommonConfiguration() {
group = rootProject.group
@ -20,6 +24,31 @@ fun Project.applyCommonConfiguration() {
}
}
plugins.withId("java") {
the<JavaPluginExtension>().toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
dependencies {
constraints {
for (conf in configurations.names) {
add(conf, "com.google.guava:guava") {
version { strictly(Versions.GUAVA) }
because("Mojang provides Guava")
}
add(conf, "com.google.code.gson:gson") {
version { strictly(Versions.GSON) }
because("Mojang provides Gson")
}
add(conf, "it.unimi.dsi:fastutil") {
version { strictly(Versions.FAST_UTIL) }
because("Mojang provides FastUtil")
}
}
}
}
apply(plugin = "net.minecrell.licenser")
configure<LicenseExtension> {
header = rootProject.file("HEADER.txt")

View File

@ -30,11 +30,6 @@ fun Project.applyPlatformAndCoreConfiguration() {
ext["internalVersion"] = "$version+${rootProject.ext["gitCommitHash"]}"
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks
.withType<JavaCompile>()
.matching { it.name == "compileJava" || it.name == "compileTestJava" }
@ -120,6 +115,7 @@ fun Project.applyShadowConfiguration() {
include(project(":worldedit-libs:core"))
include(project(":worldedit-libs:${project.name.replace("worldedit-", "")}"))
include(project(":worldedit-core"))
exclude("com.google.code.findbugs:jsr305")
}
exclude("GradleStart**")
exclude(".cache")

View File

@ -4,9 +4,10 @@ object Versions {
const val TEXT = "3.0.4"
const val TEXT_EXTRAS = "3.0.6"
const val PISTON = "0.5.6"
const val AUTO_VALUE = "1.7"
const val JUNIT = "5.6.1"
const val MOCKITO = "3.3.3"
const val AUTO_VALUE = "1.7.4"
const val JUNIT = "5.7.0"
const val MOCKITO = "3.7.7"
const val SLF4J = "1.7.30"
const val LOGBACK = "1.2.3"
const val FAST_UTIL = "8.2.1"
const val GUAVA = "21.0"

View File

@ -4,5 +4,5 @@ version=7.2.3-SNAPSHOT
org.gradle.jvmargs=-Xmx1512M
org.gradle.parallel=true
loom.version=0.4.33
loom.version=0.5.43
mixin.version=0.8.1+build.21

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -6,6 +6,7 @@ listOf("bukkit", "core", "forge", "sponge", "fabric", "cli").forEach {
include("worldedit-libs:$it")
include("worldedit-$it")
}
include("worldedit-mod")
include("worldedit-libs:core:ap")
include("worldedit-core:doctools")

View File

@ -9,7 +9,6 @@ applyShadowConfiguration()
repositories {
maven { url = uri("https://hub.spigotmc.org/nexus/content/groups/public") }
maven { url = uri("https://repo.codemc.org/repository/maven-public") }
maven { url = uri("https://papermc.io/repo/repository/maven-public/") }
}
@ -25,13 +24,13 @@ dependencies {
"api"("org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT") {
exclude("junit", "junit")
}
"compileOnly"("org.jetbrains:annotations:19.0.0")
"compileOnly"("org.jetbrains:annotations:20.1.0")
"compileOnly"("com.destroystokyo.paper:paper-api:1.16.1-R0.1-SNAPSHOT")
"implementation"("io.papermc:paperlib:1.0.2")
"implementation"("io.papermc:paperlib:1.0.6")
"compileOnly"("com.sk89q:dummypermscompat:1.10")
"implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1")
"implementation"("org.bstats:bstats-bukkit:1.7")
"implementation"("it.unimi.dsi:fastutil:${Versions.FAST_UTIL}")
"implementation"("org.slf4j:slf4j-jdk14:${Versions.SLF4J}")
"implementation"("org.bstats:bstats-bukkit:2.1.0")
"implementation"("it.unimi.dsi:fastutil")
"testImplementation"("org.mockito:mockito-core:1.9.0-rc1")
}
@ -59,11 +58,11 @@ tasks.named<ShadowJar>("shadowJar") {
include(dependency("org.slf4j:slf4j-api"))
include(dependency("org.apache.logging.log4j:log4j-slf4j-impl"))
include(dependency("org.antlr:antlr4-runtime"))
relocate("org.bstats", "com.sk89q.worldedit.bukkit.bstats") {
include(dependency("org.bstats:bstats-bukkit:1.7"))
relocate("org.bstats", "com.sk89q.worldedit.bstats") {
include(dependency("org.bstats:"))
}
relocate("io.papermc.lib", "com.sk89q.worldedit.bukkit.paperlib") {
include(dependency("io.papermc:paperlib:1.0.2"))
include(dependency("io.papermc:paperlib"))
}
relocate("it.unimi.dsi.fastutil", "com.sk89q.worldedit.bukkit.fastutil") {
include(dependency("it.unimi.dsi:fastutil"))

View File

@ -9,11 +9,12 @@ applyShadowConfiguration()
dependencies {
"api"(project(":worldedit-core"))
"implementation"("org.apache.logging.log4j:log4j-core:2.8.1")
"implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1")
"implementation"(platform("org.apache.logging.log4j:log4j-bom:2.14.0"))
"implementation"("org.apache.logging.log4j:log4j-core")
"implementation"("org.apache.logging.log4j:log4j-slf4j-impl")
"implementation"("commons-cli:commons-cli:1.4")
"implementation"("com.google.guava:guava:${Versions.GUAVA}")
"implementation"("com.google.code.gson:gson:${Versions.GSON}")
"implementation"("com.google.guava:guava")
"implementation"("com.google.code.gson:gson")
}
tasks.named<Jar>("jar") {

View File

@ -6,7 +6,6 @@ plugins {
id("net.ltgt.apt-eclipse")
id("net.ltgt.apt-idea")
id("antlr")
id("com.mendhak.gradlecrowdin")
}
applyPlatformAndCoreConfiguration()
@ -19,31 +18,36 @@ repositories {
artifact("[organisation]/[module]/[revision]/[artifact]-[revision](+[classifier])(.[ext])")
setM2compatible(true)
}
metadataSources {
artifact()
}
}
}
configurations {
all {
resolutionStrategy {
force("com.google.guava:guava:21.0")
}
}
register("languageFiles")
}
dependencies {
"api"(project(":worldedit-libs:core"))
"implementation"("de.schlichtherle:truezip:6.8.3")
"implementation"("net.java.truevfs:truevfs-profile-default_2.13:0.12.1")
"implementation"("org.mozilla:rhino-runtime:1.7.12")
"implementation"("org.yaml:snakeyaml:1.9")
"implementation"("com.google.guava:guava:${Versions.GUAVA}")
"implementation"("com.google.code.findbugs:jsr305:1.3.9")
"implementation"("com.google.code.gson:gson:${Versions.GSON}")
"implementation"("org.slf4j:slf4j-api:1.7.26")
"implementation"("it.unimi.dsi:fastutil:${Versions.FAST_UTIL}")
constraints {
"implementation"( "org.yaml:snakeyaml") {
version { strictly("1.26") }
because("Bukkit provides SnakeYaml")
}
}
val antlrVersion = "4.7.2"
"api"(project(":worldedit-libs:core"))
"implementation"("de.schlichtherle:truezip:6.8.4")
"implementation"("net.java.truevfs:truevfs-profile-default_2.13:0.12.1")
"implementation"("org.mozilla:rhino-runtime:1.7.13")
"implementation"("org.yaml:snakeyaml")
"implementation"("com.google.guava:guava")
"implementation"("com.google.code.findbugs:jsr305:1.3.9")
"implementation"("com.google.code.gson:gson")
"implementation"("org.slf4j:slf4j-api:${Versions.SLF4J}")
"implementation"("it.unimi.dsi:fastutil")
val antlrVersion = "4.9.1"
"antlr"("org.antlr:antlr4:$antlrVersion")
"implementation"("org.antlr:antlr4-runtime:$antlrVersion")

View File

@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.3.41"
kotlin("jvm") version "1.4.21"
application
}
@ -11,7 +11,7 @@ tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
application.mainClassName = "com.sk89q.worldedit.internal.util.DocumentationPrinter"
application.mainClass.set("com.sk89q.worldedit.internal.util.DocumentationPrinter")
tasks.named<JavaExec>("run") {
workingDir = rootProject.projectDir
}
@ -21,5 +21,5 @@ dependencies {
"implementation"(project(":worldedit-core"))
"implementation"(kotlin("stdlib-jdk8"))
"implementation"(kotlin("reflect"))
"implementation"("com.google.guava:guava:${Versions.GUAVA}")
"implementation"("com.google.guava:guava")
}

View File

@ -151,7 +151,7 @@ class DocumentationPrinter private constructor() {
}
private fun writeHeader() {
cmdOutput.appendln("""
cmdOutput.appendLine("""
========
Commands
========
@ -168,7 +168,7 @@ Commands
You can access a command listing in-game via the ``//help`` command.
""".trim())
permsOutput.appendln("""
permsOutput.appendLine("""
===========
Permissions
===========
@ -186,11 +186,11 @@ See the :doc:`commands` page for an explanation of some of these commands.
:header: Command, Permission
:widths: 15, 25
""".trim())
permsOutput.appendln()
permsOutput.appendLine()
}
private fun writeFooter() {
permsOutput.appendln()
permsOutput.appendLine()
permsOutput.append("""
Other Permissions
==================
@ -256,10 +256,10 @@ Other Permissions
val name = prefix + command.name
val entries = commandTableEntries(command, parents)
cmdOutput.appendln(".. raw:: html")
cmdOutput.appendln()
cmdOutput.appendln(""" <span id="command-${linkSafe(name)}"></span>""")
cmdOutput.appendln()
cmdOutput.appendLine(".. raw:: html")
cmdOutput.appendLine()
cmdOutput.appendLine(""" <span id="command-${linkSafe(name)}"></span>""")
cmdOutput.appendLine()
cmdOutput.append(".. topic:: ``$name``")
if (!command.aliases.isEmpty()) {
command.aliases.joinTo(cmdOutput, ", ",
@ -267,19 +267,19 @@ Other Permissions
postfix = ")",
transform = { "``$prefix$it``" })
}
cmdOutput.appendln()
cmdOutput.appendln(" :class: command-topic").appendln()
cmdOutput.appendLine()
cmdOutput.appendLine(" :class: command-topic").appendLine()
CommandUtil.deprecationWarning(command).ifPresent { warning ->
cmdOutput.appendln("""
cmdOutput.appendLine("""
| .. WARNING::
| ${reduceToRst(warning).makeRstSafe("\n\n")}
""".trimMargin())
}
cmdOutput.appendln("""
cmdOutput.appendLine("""
| .. csv-table::
| :widths: 8, 15
""".trimMargin())
cmdOutput.appendln()
cmdOutput.appendLine()
for ((k, v) in entries) {
val rstSafe = v.makeRstSafe("\n")
cmdOutput.append(" ".repeat(2))
@ -287,9 +287,9 @@ Other Permissions
.append(",")
.append('"')
.append(rstSafe)
.append('"').appendln()
.append('"').appendLine()
}
cmdOutput.appendln()
cmdOutput.appendLine()
}
private fun String.makeRstSafe(lineJoiner: String) = trim()

View File

@ -46,7 +46,10 @@ repositories {
dependencies {
"api"(project(":worldedit-core"))
"implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1")
"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")
@ -133,7 +136,7 @@ tasks.named<ShadowJar>("shadowJar") {
archiveClassifier.set("dist-dev")
dependencies {
relocate("org.slf4j", "com.sk89q.worldedit.slf4j")
relocate("org.apache.logging.slf4j", "com.sk89q.worldedit.log4jbridge")
relocate("org.apache.logging.slf4j", "com.sk89q.worldedit.l4j")
relocate("org.antlr.v4", "com.sk89q.worldedit.antlr4")
include(dependency("org.slf4j:slf4j-api"))

View File

@ -27,7 +27,10 @@ configurations.all {
dependencies {
"api"(project(":worldedit-core"))
"implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.11.2")
"implementation"(enforcedPlatform("org.apache.logging.log4j:log4j-bom:2.8.1") {
because("Forge provides Log4J (Mojang provides a lower version, but Forge bumps)")
})
"implementation"("org.apache.logging.log4j:log4j-slf4j-impl")
"minecraft"("net.minecraftforge:forge:$minecraftVersion-$forgeVersion")
}
@ -93,7 +96,7 @@ addJarManifest(includeClasspath = false)
tasks.named<ShadowJar>("shadowJar") {
dependencies {
relocate("org.slf4j", "com.sk89q.worldedit.slf4j")
relocate("org.apache.logging.slf4j", "com.sk89q.worldedit.log4jbridge")
relocate("org.apache.logging.slf4j", "com.sk89q.worldedit.l4j")
relocate("org.antlr.v4", "com.sk89q.worldedit.antlr4")
include(dependency("org.slf4j:slf4j-api"))

2
worldedit-mod/README.md Normal file
View File

@ -0,0 +1,2 @@
This folder is for the merged output of Fabric and Forge jars. This allows us to distribute
both variants of the mod in a single file to avoid end-user confusion.

View File

@ -0,0 +1,24 @@
import net.fabricmc.loom.task.RemapJarTask
plugins {
base
}
applyCommonConfiguration()
tasks.register<Jar>("jar") {
val remapFabric = project(":worldedit-fabric").tasks.named<RemapJarTask>("remapShadowJar")
dependsOn(
remapFabric,
project(":worldedit-forge").tasks.named("reobfShadowJar")
)
from(zipTree({remapFabric.get().archiveFile}))
from(zipTree({project(":worldedit-forge").tasks.getByName("shadowJar").outputs.files.singleFile}))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set("dist")
}
tasks.named("assemble") {
dependsOn("jar")
}

View File

@ -1,28 +1,28 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id("org.spongepowered.plugin")
id("org.spongepowered.gradle.plugin")
}
applyPlatformAndCoreConfiguration()
applyShadowConfiguration()
// I can't believe sponge sets this in a base plugin with no opt-out
convention.getPlugin(JavaPluginConvention::class.java).apply {
setSourceCompatibility(null)
setTargetCompatibility(null)
}
repositories {
maven { url = uri("https://repo.codemc.org/repository/maven-public") }
}
dependencies {
compile(project(":worldedit-core"))
compile(project(":worldedit-libs:sponge"))
compile("org.spongepowered:spongeapi:7.1.0")
compile("org.bstats:bstats-sponge:1.7")
testCompile("org.mockito:mockito-core:1.9.0-rc1")
}
sponge {
plugin {
id = "worldedit"
}
api(project(":worldedit-core"))
api(project(":worldedit-libs:sponge"))
api("org.spongepowered:spongeapi:7.1.0")
api("org.bstats:bstats-sponge:1.7")
testImplementation("org.mockito:mockito-core:1.9.0-rc1")
}
addJarManifest(includeClasspath = true)