Forge now nearly works, it just dosent have a preprocessor

This commit is contained in:
coolGi
2023-02-24 21:35:50 +10:30
parent 0ff7a5cd11
commit 1a09edd8bb
2 changed files with 33 additions and 7 deletions
+32 -6
View File
@@ -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
+1 -1
View File
@@ -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=