From 2dfe2eeccca37dd63588dc2690bfcfabfcc949ea Mon Sep 17 00:00:00 2001 From: Technici4n <13494793+Technici4n@users.noreply.github.com> Date: Mon, 8 Apr 2024 20:29:38 +0200 Subject: [PATCH] Merge SPI into loader sourceset (#109) --- .gitignore | 4 +-- loader/build.gradle | 10 ++++++- .../net/neoforged/fml/loading/FMLLoader.java | 8 ----- .../neoforged/neoforgespi/Environment.java | 0 .../earlywindow/GraphicsBootstrapper.java | 0 .../earlywindow/ImmediateWindowProvider.java | 0 .../neoforgespi/language/IConfigurable.java | 0 .../neoforgespi/language/ILifecycleEvent.java | 0 .../neoforgespi/language/IModFileInfo.java | 0 .../neoforgespi/language/IModInfo.java | 0 .../language/IModLanguageProvider.java | 0 .../language/MavenVersionAdapter.java | 0 .../neoforgespi/language/ModFileScanData.java | 7 ++++- .../neoforgespi/locating/ForgeFeature.java | 0 .../locating/IDependencyLocator.java | 0 .../locating/IModDirectoryLocatorFactory.java | 0 .../neoforgespi/locating/IModFile.java | 1 - .../neoforgespi/locating/IModLocator.java | 0 .../neoforgespi/locating/IModProvider.java | 0 .../neoforgespi/locating/ModFileFactory.java | 0 .../locating/ModFileLoadingException.java | 0 .../neoforgespi/language/ModInfoTest.java | 0 settings.gradle | 1 - spi/build.gradle | 29 ------------------- 24 files changed, 17 insertions(+), 43 deletions(-) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/Environment.java (100%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/earlywindow/GraphicsBootstrapper.java (100%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/earlywindow/ImmediateWindowProvider.java (100%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/language/IConfigurable.java (100%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/language/ILifecycleEvent.java (100%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/language/IModFileInfo.java (100%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/language/IModInfo.java (100%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/language/IModLanguageProvider.java (100%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/language/MavenVersionAdapter.java (100%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/language/ModFileScanData.java (90%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/locating/ForgeFeature.java (100%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/locating/IDependencyLocator.java (100%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/locating/IModDirectoryLocatorFactory.java (100%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/locating/IModFile.java (99%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/locating/IModLocator.java (100%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/locating/IModProvider.java (100%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/locating/ModFileFactory.java (100%) rename {spi => loader}/src/main/java/net/neoforged/neoforgespi/locating/ModFileLoadingException.java (100%) rename {spi => loader}/src/test/java/net/neoforged/neoforgespi/language/ModInfoTest.java (100%) delete mode 100644 spi/build.gradle diff --git a/.gitignore b/.gitignore index a0e12d003..689639f49 100644 --- a/.gitignore +++ b/.gitignore @@ -27,5 +27,5 @@ changelog.txt *.7z /logs/ -# SPI tests produce this... -/spi/logs/ +# Our tests produce this... +/loader/logs/ diff --git a/loader/build.gradle b/loader/build.gradle index 71b57ed5c..2f9d6509f 100644 --- a/loader/build.gradle +++ b/loader/build.gradle @@ -4,7 +4,6 @@ dependencies { api("org.ow2.asm:asm:${asm_version}") api("org.ow2.asm:asm-tree:${asm_version}") api("org.ow2.asm:asm-commons:${asm_version}") - api(project(':spi')) api("net.neoforged:mergetool:${mergetool_version}:api") api("org.apache.logging.log4j:log4j-api:${log4j_version}") api("org.slf4j:slf4j-api:${slf4j_api_version}") @@ -36,6 +35,11 @@ dependencies { testCompileOnly("org.jetbrains:annotations:${jetbrains_annotations_version}") testRuntimeOnly("cpw.mods:bootstraplauncher:${bootstraplauncher_version}") + testRuntimeOnly("org.apache.logging.log4j:log4j-core:$log4j_version") + testImplementation("org.junit.jupiter:junit-jupiter-api:$jupiter_version") + testImplementation("org.powermock:powermock-core:$powermock_version") + testImplementation("org.hamcrest:hamcrest-core:2.2+") + testImplementation("org.junit.jupiter:junit-jupiter-engine:$jupiter_version") } spotless { @@ -56,3 +60,7 @@ spotless { bumpThisNumberIfACustomStepChanges(1) } } + +test { + useJUnitPlatform() +} diff --git a/loader/src/main/java/net/neoforged/fml/loading/FMLLoader.java b/loader/src/main/java/net/neoforged/fml/loading/FMLLoader.java index 1bb8b8080..f2d7d0cd0 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/FMLLoader.java +++ b/loader/src/main/java/net/neoforged/fml/loading/FMLLoader.java @@ -31,7 +31,6 @@ import net.neoforged.fml.loading.moddiscovery.ModFile; import net.neoforged.fml.loading.moddiscovery.ModValidator; import net.neoforged.fml.loading.targets.CommonLaunchHandler; -import net.neoforged.neoforgespi.Environment; import org.slf4j.Logger; public class FMLLoader { @@ -92,13 +91,6 @@ static void onInitialLoad(IEnvironment environment, Set otherServices) t coreModEngine = new CoreModScriptingEngine(); LOGGER.debug(LogMarkers.CORE, "FML found CoreMods version : {}", coreModEngine.getClass().getPackage().getImplementationVersion()); - LOGGER.debug(LogMarkers.CORE, "Found ForgeSPI package implementation version {}", Environment.class.getPackage().getImplementationVersion()); - LOGGER.debug(LogMarkers.CORE, "Found ForgeSPI package specification {}", Environment.class.getPackage().getSpecificationVersion()); - if (Integer.parseInt(Environment.class.getPackage().getSpecificationVersion()) < 2) { - LOGGER.error(LogMarkers.CORE, "Found an out of date ForgeSPI implementation: {}, loading cannot continue", Environment.class.getPackage().getSpecificationVersion()); - throw new IncompatibleEnvironmentException("ForgeSPI is out of date, we cannot continue"); - } - try { Class.forName("com.electronwill.nightconfig.core.Config", false, environment.getClass().getClassLoader()); Class.forName("com.electronwill.nightconfig.toml.TomlFormat", false, environment.getClass().getClassLoader()); diff --git a/spi/src/main/java/net/neoforged/neoforgespi/Environment.java b/loader/src/main/java/net/neoforged/neoforgespi/Environment.java similarity index 100% rename from spi/src/main/java/net/neoforged/neoforgespi/Environment.java rename to loader/src/main/java/net/neoforged/neoforgespi/Environment.java diff --git a/spi/src/main/java/net/neoforged/neoforgespi/earlywindow/GraphicsBootstrapper.java b/loader/src/main/java/net/neoforged/neoforgespi/earlywindow/GraphicsBootstrapper.java similarity index 100% rename from spi/src/main/java/net/neoforged/neoforgespi/earlywindow/GraphicsBootstrapper.java rename to loader/src/main/java/net/neoforged/neoforgespi/earlywindow/GraphicsBootstrapper.java diff --git a/spi/src/main/java/net/neoforged/neoforgespi/earlywindow/ImmediateWindowProvider.java b/loader/src/main/java/net/neoforged/neoforgespi/earlywindow/ImmediateWindowProvider.java similarity index 100% rename from spi/src/main/java/net/neoforged/neoforgespi/earlywindow/ImmediateWindowProvider.java rename to loader/src/main/java/net/neoforged/neoforgespi/earlywindow/ImmediateWindowProvider.java diff --git a/spi/src/main/java/net/neoforged/neoforgespi/language/IConfigurable.java b/loader/src/main/java/net/neoforged/neoforgespi/language/IConfigurable.java similarity index 100% rename from spi/src/main/java/net/neoforged/neoforgespi/language/IConfigurable.java rename to loader/src/main/java/net/neoforged/neoforgespi/language/IConfigurable.java diff --git a/spi/src/main/java/net/neoforged/neoforgespi/language/ILifecycleEvent.java b/loader/src/main/java/net/neoforged/neoforgespi/language/ILifecycleEvent.java similarity index 100% rename from spi/src/main/java/net/neoforged/neoforgespi/language/ILifecycleEvent.java rename to loader/src/main/java/net/neoforged/neoforgespi/language/ILifecycleEvent.java diff --git a/spi/src/main/java/net/neoforged/neoforgespi/language/IModFileInfo.java b/loader/src/main/java/net/neoforged/neoforgespi/language/IModFileInfo.java similarity index 100% rename from spi/src/main/java/net/neoforged/neoforgespi/language/IModFileInfo.java rename to loader/src/main/java/net/neoforged/neoforgespi/language/IModFileInfo.java diff --git a/spi/src/main/java/net/neoforged/neoforgespi/language/IModInfo.java b/loader/src/main/java/net/neoforged/neoforgespi/language/IModInfo.java similarity index 100% rename from spi/src/main/java/net/neoforged/neoforgespi/language/IModInfo.java rename to loader/src/main/java/net/neoforged/neoforgespi/language/IModInfo.java diff --git a/spi/src/main/java/net/neoforged/neoforgespi/language/IModLanguageProvider.java b/loader/src/main/java/net/neoforged/neoforgespi/language/IModLanguageProvider.java similarity index 100% rename from spi/src/main/java/net/neoforged/neoforgespi/language/IModLanguageProvider.java rename to loader/src/main/java/net/neoforged/neoforgespi/language/IModLanguageProvider.java diff --git a/spi/src/main/java/net/neoforged/neoforgespi/language/MavenVersionAdapter.java b/loader/src/main/java/net/neoforged/neoforgespi/language/MavenVersionAdapter.java similarity index 100% rename from spi/src/main/java/net/neoforged/neoforgespi/language/MavenVersionAdapter.java rename to loader/src/main/java/net/neoforged/neoforgespi/language/MavenVersionAdapter.java diff --git a/spi/src/main/java/net/neoforged/neoforgespi/language/ModFileScanData.java b/loader/src/main/java/net/neoforged/neoforgespi/language/ModFileScanData.java similarity index 90% rename from spi/src/main/java/net/neoforged/neoforgespi/language/ModFileScanData.java rename to loader/src/main/java/net/neoforged/neoforgespi/language/ModFileScanData.java index 666cb242f..18eb13ead 100644 --- a/spi/src/main/java/net/neoforged/neoforgespi/language/ModFileScanData.java +++ b/loader/src/main/java/net/neoforged/neoforgespi/language/ModFileScanData.java @@ -6,7 +6,12 @@ package net.neoforged.neoforgespi.language; import java.lang.annotation.ElementType; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.function.Predicate; import org.objectweb.asm.Type; diff --git a/spi/src/main/java/net/neoforged/neoforgespi/locating/ForgeFeature.java b/loader/src/main/java/net/neoforged/neoforgespi/locating/ForgeFeature.java similarity index 100% rename from spi/src/main/java/net/neoforged/neoforgespi/locating/ForgeFeature.java rename to loader/src/main/java/net/neoforged/neoforgespi/locating/ForgeFeature.java diff --git a/spi/src/main/java/net/neoforged/neoforgespi/locating/IDependencyLocator.java b/loader/src/main/java/net/neoforged/neoforgespi/locating/IDependencyLocator.java similarity index 100% rename from spi/src/main/java/net/neoforged/neoforgespi/locating/IDependencyLocator.java rename to loader/src/main/java/net/neoforged/neoforgespi/locating/IDependencyLocator.java diff --git a/spi/src/main/java/net/neoforged/neoforgespi/locating/IModDirectoryLocatorFactory.java b/loader/src/main/java/net/neoforged/neoforgespi/locating/IModDirectoryLocatorFactory.java similarity index 100% rename from spi/src/main/java/net/neoforged/neoforgespi/locating/IModDirectoryLocatorFactory.java rename to loader/src/main/java/net/neoforged/neoforgespi/locating/IModDirectoryLocatorFactory.java diff --git a/spi/src/main/java/net/neoforged/neoforgespi/locating/IModFile.java b/loader/src/main/java/net/neoforged/neoforgespi/locating/IModFile.java similarity index 99% rename from spi/src/main/java/net/neoforged/neoforgespi/locating/IModFile.java rename to loader/src/main/java/net/neoforged/neoforgespi/locating/IModFile.java index ae9e73616..22afeb41d 100644 --- a/spi/src/main/java/net/neoforged/neoforgespi/locating/IModFile.java +++ b/loader/src/main/java/net/neoforged/neoforgespi/locating/IModFile.java @@ -10,7 +10,6 @@ import java.util.List; import java.util.Map; import java.util.function.Supplier; -import net.neoforged.neoforgespi.language.*; import net.neoforged.neoforgespi.language.IModFileInfo; import net.neoforged.neoforgespi.language.IModInfo; import net.neoforged.neoforgespi.language.IModLanguageProvider; diff --git a/spi/src/main/java/net/neoforged/neoforgespi/locating/IModLocator.java b/loader/src/main/java/net/neoforged/neoforgespi/locating/IModLocator.java similarity index 100% rename from spi/src/main/java/net/neoforged/neoforgespi/locating/IModLocator.java rename to loader/src/main/java/net/neoforged/neoforgespi/locating/IModLocator.java diff --git a/spi/src/main/java/net/neoforged/neoforgespi/locating/IModProvider.java b/loader/src/main/java/net/neoforged/neoforgespi/locating/IModProvider.java similarity index 100% rename from spi/src/main/java/net/neoforged/neoforgespi/locating/IModProvider.java rename to loader/src/main/java/net/neoforged/neoforgespi/locating/IModProvider.java diff --git a/spi/src/main/java/net/neoforged/neoforgespi/locating/ModFileFactory.java b/loader/src/main/java/net/neoforged/neoforgespi/locating/ModFileFactory.java similarity index 100% rename from spi/src/main/java/net/neoforged/neoforgespi/locating/ModFileFactory.java rename to loader/src/main/java/net/neoforged/neoforgespi/locating/ModFileFactory.java diff --git a/spi/src/main/java/net/neoforged/neoforgespi/locating/ModFileLoadingException.java b/loader/src/main/java/net/neoforged/neoforgespi/locating/ModFileLoadingException.java similarity index 100% rename from spi/src/main/java/net/neoforged/neoforgespi/locating/ModFileLoadingException.java rename to loader/src/main/java/net/neoforged/neoforgespi/locating/ModFileLoadingException.java diff --git a/spi/src/test/java/net/neoforged/neoforgespi/language/ModInfoTest.java b/loader/src/test/java/net/neoforged/neoforgespi/language/ModInfoTest.java similarity index 100% rename from spi/src/test/java/net/neoforged/neoforgespi/language/ModInfoTest.java rename to loader/src/test/java/net/neoforged/neoforgespi/language/ModInfoTest.java diff --git a/settings.gradle b/settings.gradle index 66d6ab09e..574f77882 100644 --- a/settings.gradle +++ b/settings.gradle @@ -24,4 +24,3 @@ rootProject.name = 'FancyModLoader' include 'loader' include 'earlydisplay' -include 'spi' diff --git a/spi/build.gradle b/spi/build.gradle deleted file mode 100644 index 6bd8a0905..000000000 --- a/spi/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -plugins { - id 'org.javamodularity.moduleplugin' - id 'maven-publish' - id 'java-library' -} - -dependencies { - implementation("cpw.mods:modlauncher:$modlauncher_version") - implementation("org.ow2.asm:asm:$asm_version") - implementation("org.ow2.asm:asm-commons:$asm_version") - implementation("org.ow2.asm:asm-tree:$asm_version") - implementation("org.apache.logging.log4j:log4j-api:$log4j_version") - implementation("org.apache.maven:maven-artifact:$apache_maven_artifact_version") - implementation("cpw.mods:securejarhandler:$securejarhandler_version") - api("net.neoforged:mergetool:$mergetool_version:api") { - transitive false - } - - - testRuntimeOnly("org.apache.logging.log4j:log4j-core:$log4j_version") - testImplementation("org.junit.jupiter:junit-jupiter-api:$jupiter_version") - testImplementation("org.powermock:powermock-core:$powermock_version") - testImplementation("org.hamcrest:hamcrest-core:2.2+") - testImplementation("org.junit.jupiter:junit-jupiter-engine:$jupiter_version") -} - -test { - useJUnitPlatform() -} \ No newline at end of file