From 8b1f043dc5fa550f27a3c80c9d6d163784991974 Mon Sep 17 00:00:00 2001 From: Octavia Togami Date: Mon, 25 Jan 2021 05:14:09 -0500 Subject: [PATCH] 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 --- COMPILING.md | 7 ++-- README.md | 40 ++++++++++++++++--- buildSrc/src/main/kotlin/CommonConfig.kt | 29 ++++++++++++++ buildSrc/src/main/kotlin/PlatformConfig.kt | 1 + buildSrc/src/main/kotlin/Versions.kt | 17 ++++++-- gradle.properties | 4 +- settings.gradle.kts | 1 + worldedit-cli/build.gradle.kts | 9 +++-- worldedit-core/doctools/build.gradle.kts | 6 +-- .../internal/util/DocumentationPrinter.kt | 30 +++++++------- worldedit-fabric/build.gradle.kts | 9 +++-- worldedit-forge/build.gradle.kts | 7 +++- worldedit-mod/README.md | 2 + worldedit-mod/build.gradle.kts | 24 +++++++++++ worldedit-sponge/build.gradle.kts | 24 +++++------ 15 files changed, 156 insertions(+), 54 deletions(-) create mode 100644 worldedit-mod/README.md create mode 100644 worldedit-mod/build.gradle.kts diff --git a/COMPILING.md b/COMPILING.md index b7f554e46..1dd9c0376 100644 --- a/COMPILING.md +++ b/COMPILING.md @@ -1,9 +1,8 @@ Compiling ========= -You can compile FastAsyncWorldEdit 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. -Newer versions of the JDK may not compile. -You only need one version of the JDK installed. +You can compile FastAsyncWorldEdit 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. FastAsyncWorldEdit is a multi-module project with two active modules: @@ -29,7 +28,7 @@ You will find: * The core FastAsyncWorldEdit API in **worldedit-core/build/libs** * FastAsyncWorldEdit for Bukkit in **worldedit-bukkit/build/libs*** -If you want to use FastAsyncWorldEdit, use the `FastAsyncWorldEdit-1.15-#` version. +If you want to use FastAsyncWorldEdit, use the `FastAsyncWorldEdit-1.16-#` version. ## Other commands diff --git a/README.md b/README.md index 8dcc311d0..3acc61ee4 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,22 @@ FAWE is a fork of WorldEdit that has huge speed and memory improvements and considerably more features -## Links +**A Minecraft Map Editor... that runs in-game!** + +* With selections, schematics, copy and paste, brushes, and scripting! +* Use it in creative, survival in single player or on your server. +* Use it on your Minecraft server to fix grieving and mistakes. + +Java Edition required. WorldEdit is compatible with Forge, Fabric, Bukkit, Spigot, Paper, and Sponge. + +## Download FastAsyncWorldEdit +### 1.15+ +* [Download](https://www.spigotmc.org/resources/fast-async-worldedit.13932/) +* [Jenkins](https://ci.athion.net/job/FastAsyncWorldEdit-1.16/) + +Looking builds for older versions? Download them [here](https://intellectualsites.github.io/download/). + +## Links * [Spigot Page](https://www.spigotmc.org/threads/fast-async-worldedit.100104/) * [Discord](https://discord.gg/KxkjDVg) @@ -15,13 +30,26 @@ FAWE is a fork of WorldEdit that has huge speed and memory improvements and cons * [Crowdin](https://intellectualsites.crowdin.com/fastasyncworldedit) * [JavaDocs](https://ci.athion.net/job/FastAsyncWorldEdit-1.16/javadoc/) -## Downloads -### 1.15+ -* [Download](https://www.spigotmc.org/resources/fast-async-worldedit.13932/) -* [Jenkins](https://ci.athion.net/job/FastAsyncWorldEdit-1.16/) +Edit the Code +--------- -Looking builds for older versions? Download them [here](https://intellectualsites.github.io/download/). +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 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` + * Windows - Command Prompt: `gradlew :worldedit-fabric:runClient` + * Windows - PowerShell: `.\gradlew :worldedit-fabric:runClient` + +🎉 That's it. 🎉 It takes a long time to actually transform WorldEdit into a mod. If it succeeds, **the Minecraft game will open and you can create a single player world with WorldEdit**. + +--- + +For additional information about compiling WorldEdit, see [COMPILING.md](COMPILING.md). +FAWE is a fork of WorldEdit that has huge speed and memory improvements and considerably more features ## Building FAWE uses gradle to build diff --git a/buildSrc/src/main/kotlin/CommonConfig.kt b/buildSrc/src/main/kotlin/CommonConfig.kt index 0b4a84b70..a2e39f17a 100644 --- a/buildSrc/src/main/kotlin/CommonConfig.kt +++ b/buildSrc/src/main/kotlin/CommonConfig.kt @@ -1,5 +1,9 @@ import org.gradle.api.Project +import org.gradle.api.plugins.JavaPluginExtension +import org.gradle.jvm.toolchain.JavaLanguageVersion +import org.gradle.kotlin.dsl.dependencies import org.gradle.kotlin.dsl.repositories +import org.gradle.kotlin.dsl.the fun Project.applyCommonConfiguration() { group = rootProject.group @@ -50,4 +54,29 @@ fun Project.applyCommonConfiguration() { cacheChangingModulesFor(5, "MINUTES") } } + + plugins.withId("java") { + the().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") + } + } + } + } } diff --git a/buildSrc/src/main/kotlin/PlatformConfig.kt b/buildSrc/src/main/kotlin/PlatformConfig.kt index c8b28e4fe..68f58640c 100644 --- a/buildSrc/src/main/kotlin/PlatformConfig.kt +++ b/buildSrc/src/main/kotlin/PlatformConfig.kt @@ -116,6 +116,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") } archiveFileName.set("FastAsyncWorldEdit-${project.version}.jar") exclude("GradleStart**") diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 77bf827ae..279a0c8ff 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -1,6 +1,19 @@ -/* import org.gradle.api.Project +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.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" + const val GSON = "2.8.0" +} + // Properties that need a project reference to resolve: class ProjectVersions(project: Project) { val loom = project.rootProject.property("loom.version") @@ -9,5 +22,3 @@ class ProjectVersions(project: Project) { val Project.versions get() = ProjectVersions(this) - - */ diff --git a/gradle.properties b/gradle.properties index 26c5e6d55..0d98971aa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,5 +8,5 @@ org.gradle.parallel=true org.gradle.caching=true org.gradle.vfs.watch=true -loom.version=0.2.6-20200124.104118-60 -mixin.version=0.8+build.17 +loom.version=0.5.43 +mixin.version=0.8.1+build.21 diff --git a/settings.gradle.kts b/settings.gradle.kts index 7e1ded413..a7e4bdc9a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -6,6 +6,7 @@ listOf("bukkit", "core").forEach { include("worldedit-libs:$it") include("worldedit-$it") } +include("worldedit-mod") include("worldedit-libs:core:ap") dependencyResolutionManagement { diff --git a/worldedit-cli/build.gradle.kts b/worldedit-cli/build.gradle.kts index e24323de8..43a537a44 100644 --- a/worldedit-cli/build.gradle.kts +++ b/worldedit-cli/build.gradle.kts @@ -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:21.0") - "implementation"("com.google.code.gson:gson:2.8.6") + "implementation"("com.google.guava:guava") + "implementation"("com.google.code.gson:gson") } tasks.named("jar") { diff --git a/worldedit-core/doctools/build.gradle.kts b/worldedit-core/doctools/build.gradle.kts index 4dacc9ca3..7f667b4bc 100644 --- a/worldedit-core/doctools/build.gradle.kts +++ b/worldedit-core/doctools/build.gradle.kts @@ -1,7 +1,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "1.4.0" + kotlin("jvm") version "1.4.21" application } @@ -11,7 +11,7 @@ tasks.withType { kotlinOptions.jvmTarget = "1.8" } -application.mainClassName = "com.sk89q.worldedit.internal.util.DocumentationPrinter" +application.mainClass.set("com.sk89q.worldedit.internal.util.DocumentationPrinter") tasks.named("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:21.0") + "implementation"("com.google.guava:guava") } diff --git a/worldedit-core/doctools/src/main/kotlin/com/sk89q/worldedit/internal/util/DocumentationPrinter.kt b/worldedit-core/doctools/src/main/kotlin/com/sk89q/worldedit/internal/util/DocumentationPrinter.kt index bd2d7b789..7a7afc18b 100644 --- a/worldedit-core/doctools/src/main/kotlin/com/sk89q/worldedit/internal/util/DocumentationPrinter.kt +++ b/worldedit-core/doctools/src/main/kotlin/com/sk89q/worldedit/internal/util/DocumentationPrinter.kt @@ -149,7 +149,7 @@ class DocumentationPrinter private constructor() { } private fun writeHeader() { - cmdOutput.appendln(""" + cmdOutput.appendLine(""" ======== Commands ======== @@ -166,7 +166,7 @@ Commands You can access a command listing in-game via the ``//help`` command. """.trim()) - permsOutput.appendln(""" + permsOutput.appendLine(""" =========== Permissions =========== @@ -184,11 +184,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 ================== @@ -254,10 +254,10 @@ Other Permissions val name = prefix + command.name val entries = commandTableEntries(command, parents) - cmdOutput.appendln(".. raw:: html") - cmdOutput.appendln() - cmdOutput.appendln(""" """) - cmdOutput.appendln() + cmdOutput.appendLine(".. raw:: html") + cmdOutput.appendLine() + cmdOutput.appendLine(""" """) + cmdOutput.appendLine() cmdOutput.append(".. topic:: ``$name``") if (!command.aliases.isEmpty()) { command.aliases.joinTo(cmdOutput, ", ", @@ -265,19 +265,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)) @@ -285,9 +285,9 @@ Other Permissions .append(",") .append('"') .append(rstSafe) - .append('"').appendln() + .append('"').appendLine() } - cmdOutput.appendln() + cmdOutput.appendLine() } private fun String.makeRstSafe(lineJoiner: String) = trim() diff --git a/worldedit-fabric/build.gradle.kts b/worldedit-fabric/build.gradle.kts index 0a4cff4e6..7208f83d4 100644 --- a/worldedit-fabric/build.gradle.kts +++ b/worldedit-fabric/build.gradle.kts @@ -18,8 +18,11 @@ configurations.all { } dependencies { - "compile"(project(":worldedit-core")) - "compile"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1") + "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") @@ -73,7 +76,7 @@ tasks.named("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")) diff --git a/worldedit-forge/build.gradle.kts b/worldedit-forge/build.gradle.kts index df6f8d21f..f8e259d48 100644 --- a/worldedit-forge/build.gradle.kts +++ b/worldedit-forge/build.gradle.kts @@ -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") { 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")) diff --git a/worldedit-mod/README.md b/worldedit-mod/README.md new file mode 100644 index 000000000..9a73d8fa1 --- /dev/null +++ b/worldedit-mod/README.md @@ -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. diff --git a/worldedit-mod/build.gradle.kts b/worldedit-mod/build.gradle.kts new file mode 100644 index 000000000..66fa8cd67 --- /dev/null +++ b/worldedit-mod/build.gradle.kts @@ -0,0 +1,24 @@ +import net.fabricmc.loom.task.RemapJarTask + +plugins { + base +} + +applyCommonConfiguration() + +tasks.register("jar") { + val remapFabric = project(":worldedit-fabric").tasks.named("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") +} diff --git a/worldedit-sponge/build.gradle.kts b/worldedit-sponge/build.gradle.kts index 58812b85a..2e46f5541 100644 --- a/worldedit-sponge/build.gradle.kts +++ b/worldedit-sponge/build.gradle.kts @@ -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.5") - 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") } <<<<<<< HEAD