From af6dca6e5e1cf2dc6a2009e2cccdd9d909c3fa44 Mon Sep 17 00:00:00 2001 From: Cutiepie <43445785+Ran-Mewo@users.noreply.github.com> Date: Tue, 21 May 2024 01:26:03 +1000 Subject: [PATCH 1/3] =?UTF-8?q?Add=20JVM=20Downgrader=20(DH=20now=20uses?= =?UTF-8?q?=20Java=20version=20=CE=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 19 +++++++++++++++++++ fabric/build.gradle | 4 ++-- forge/build.gradle | 4 ++-- neoforge/build.gradle | 4 ++-- settings.gradle | 8 ++++++++ 5 files changed, 33 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index f3c40c3b5..1e62674b9 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,8 @@ plugins { // Architectury is used here only as a replacement for forge's own loom id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false + + id 'xyz.wagyourtail.jvmdowngrader' version '0.4.0' apply true } @@ -102,6 +104,7 @@ subprojects { p -> // Apply plugins apply plugin: "java" apply plugin: "com.github.johnrengelman.shadow" + apply plugin: "xyz.wagyourtail.jvmdowngrader" if (isMinecraftSubProject) apply plugin: "systems.manifold.manifold-gradle-plugin" @@ -313,6 +316,22 @@ subprojects { p -> // Using jar.finalizedBy(shadowJar) causes issues so we do this scuffed bypass jar.dependsOn(shadowJar) + // For downgrading our project to Java 8 + if (isMinecraftSubProject) { + task jarDowngrade(type: xyz.wagyourtail.jvmdg.gradle.task.DowngradeJar) { + inputFile = tasks.shadowJar.archiveFile + archiveClassifier = "downgraded-8" + } + task apiDowngrade(type: xyz.wagyourtail.jvmdg.gradle.task.ShadeAPI) { + inputFile = jarDowngrade.archiveFile + archiveClassifier = "downgraded-8-shaded" + } + + // We're using a custom downgrade task so we disable the original downgrade tasks + downgradeJar.enabled = false + shadeDowngradedApi.enabled = false + } + // Put stuff from gradle.properties into the mod info processResources { diff --git a/fabric/build.gradle b/fabric/build.gradle index accf863fc..2d3b583fc 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -23,8 +23,8 @@ loom { } remapJar { - inputFile = shadowJar.archiveFile - dependsOn shadowJar + inputFile = apiDowngrade.archiveFile + dependsOn apiDowngrade } diff --git a/forge/build.gradle b/forge/build.gradle index 790890245..ea30313f3 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -51,8 +51,8 @@ loom { } remapJar { - inputFile = shadowJar.archiveFile - dependsOn shadowJar + inputFile = apiDowngrade.archiveFile + dependsOn apiDowngrade } def addMod(path, enabled) { diff --git a/neoforge/build.gradle b/neoforge/build.gradle index f5ab276fd..4b5290e17 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -67,8 +67,8 @@ loom { } remapJar { - inputFile = shadowJar.archiveFile - dependsOn shadowJar + inputFile = apiDowngrade.archiveFile + dependsOn apiDowngrade // classifier null atAccessWideners.add("distanthorizons.accesswidener") diff --git a/settings.gradle b/settings.gradle index fb99f9435..a76ea809a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -33,6 +33,14 @@ pluginManagement { name "ParchmentMC" url "https://maven.parchmentmc.org" } + maven { // Used for downgrading Java versions + name "Wagyourtail Release Repository" + url "https://maven.wagyourtail.xyz/releases" + } + maven { // Used for downgrading Java versions + name "Wagyourtail Snapshot Repository" + url "https://maven.wagyourtail.xyz/snapshots" + } mavenCentral() gradlePluginPortal() From c4a9e7a2a75b6e68cc19bf88e63309ff80f5c24a Mon Sep 17 00:00:00 2001 From: Cutiepie <43445785+Ran-Mewo@users.noreply.github.com> Date: Tue, 21 May 2024 01:56:33 +1000 Subject: [PATCH 2/3] =?UTF-8?q?Set=20the=20core=20to=20use=20Java=20versio?= =?UTF-8?q?n=20=CE=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 1e62674b9..9436b60ed 100644 --- a/build.gradle +++ b/build.gradle @@ -630,14 +630,17 @@ allprojects { p -> tasks.withType(JavaCompile) { if (isMinecraftSubProject) { - options.release = rootProject.java_version as Integer + options.release = rootProject.java_version as Integer // Neoforge complains without this options.compilerArgs += ["-Xplugin:Manifold"] - } else { - options.release = 8; // Core & Api should use Java 8 no matter what - //options.release = rootProject.java_version as Integer // But if you want to test some stuff, then this can be enabled } options.encoding = "UTF-8" } + + // Sets the project's actual Java version (it's recommended to use this over the `options.release` method above) + java { + sourceCompatibility = rootProject.java_version + targetCompatibility = rootProject.java_version + } java { withSourcesJar() From e274c9e004a89fc35933d2056d4e534f58a22c29 Mon Sep 17 00:00:00 2001 From: Cutiepie <43445785+Ran-Mewo@users.noreply.github.com> Date: Tue, 21 May 2024 11:53:00 +1000 Subject: [PATCH 3/3] =?UTF-8?q?Properly=20shade=20libraries=20when=20using?= =?UTF-8?q?=20Java=20version=20=CE=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9436b60ed..8c60421e8 100644 --- a/build.gradle +++ b/build.gradle @@ -285,7 +285,7 @@ subprojects { p -> relocate "com.seibel.distanthorizons.fabriclike", "loaderCommon.${p.name}.com.seibel.distanthorizons.fabriclike" // Move the loader files to a different location } } - def librariesLocation = "distanthorizons.libraries" + def librariesLocation = "DistantHorizons.libraries" // LWJGL // Only ever shadow the dependencies we use otherwise some stuff would break when running on an external client