From 1a09edd8bb20fe103348817b9974bcf2b9229c36 Mon Sep 17 00:00:00 2001 From: coolGi Date: Fri, 24 Feb 2023 21:35:50 +1030 Subject: [PATCH] Forge now nearly works, it just dosent have a preprocessor --- build.gradle | 38 ++++++++++++++++++++++++----- versionProperties/1.18.2.properties | 2 +- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 35aaefaac..58451b502 100644 --- a/build.gradle +++ b/build.gradle @@ -93,11 +93,24 @@ subprojects { p -> // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge")" // Useful later on so we dont have duplicated code def isMinecraftSubProject = p != project(":core") && p != project(":api") + // You can not enable manifold when forge is updating its mappings, so this is a hacky fix for it + def enableForgeManifold = false + gradle.taskGraph.whenReady { taskGraph -> + // Only add manifold to forge when this is disabled + // runtimeClasspathCopy runs when forge is attempting to compile the mappings + // but if manifold is enabled at that time then it would fail + // FIXME: This hack dosent work :/ +// println taskGraph.allTasks + if (!taskGraph.hasTask(":forge:runtimeClasspathCopy")) { + println "Enabling forge manifold" + enableForgeManifold = true + } + } // Apply plugins apply plugin: "java" - if (isMinecraftSubProject) + if (isMinecraftSubProject && enableForgeManifold) apply plugin: "systems.manifold.manifold-gradle-plugin" apply plugin: "com.github.johnrengelman.shadow" // apply plugin: "org.spongepowered.gradle.vanilla" // Provides minecraft libraries @@ -107,9 +120,10 @@ subprojects { p -> // Set the manifold version (may not be required tough) - manifold { - manifoldVersion = rootProject.manifold_version - } + if (enableForgeManifold) + manifold { + manifoldVersion = rootProject.manifold_version + } // set up custom configurations (configurations are a way to handle dependencies) @@ -148,7 +162,7 @@ subprojects { p -> // Manifold - if (isMinecraftSubProject) + if (isMinecraftSubProject && enableForgeManifold) annotationProcessor("systems.manifold:manifold-preprocessor:${rootProject.manifold_version}") // Log4j @@ -244,6 +258,18 @@ allprojects { p -> // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge")" // Useful later on so we dont have duplicated code def isMinecraftSubProject = p != project(":core") && p != project(":api") + // You can not enable manifold when forge is updating its mappings, so this is a hacky fix for it + def enableForgeManifold = false + gradle.taskGraph.whenReady { taskGraph -> + // Only add manifold to forge when this is disabled + // runtimeClasspathCopy runs when forge is attempting to compile the mappings + // but if manifold is enabled at that time then it would fail + println taskGraph.allTasks + if (!taskGraph.hasTask(":forge:runtimeClasspathCopy")) { + println "Enabling forge manifold" + enableForgeManifold = true + } + } apply plugin: "java" @@ -410,7 +436,7 @@ allprojects { p -> tasks.withType(JavaCompile) { if (isMinecraftSubProject) { options.release = rootProject.java_version as Integer - if (p != project(":forge")) // FIXME + if (enableForgeManifold) options.compilerArgs += ['-Xplugin:Manifold'] } else { options.release = 8; // Core & Api should use Java 8 no matter what diff --git a/versionProperties/1.18.2.properties b/versionProperties/1.18.2.properties index 5a25cf599..2d46c8579 100644 --- a/versionProperties/1.18.2.properties +++ b/versionProperties/1.18.2.properties @@ -34,7 +34,7 @@ fabric_api_version=0.67.1+1.18.2 enable_canvas=0 # Forge loader -forge_version=40.0.18 +forge_version=40.0.32 # TODO: Update forge # Forge mod versions starlight_version_forge= terraforged_version=