Separate Forge runtime into its own subproject

This commit is contained in:
Juuxel
2021-06-28 22:44:02 +03:00
parent 9d31be3729
commit ae5bc4df15
15 changed files with 101 additions and 59 deletions

View File

@@ -136,7 +136,8 @@ public class LaunchProvider extends DependencyProvider {
annotationDependency = addDependency(Constants.Dependencies.JETBRAINS_ANNOTATIONS + Constants.Dependencies.Versions.JETBRAINS_ANNOTATIONS, JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME);
if (getExtension().isForge()) {
addDependency(Constants.Dependencies.JAVAX_ANNOTATIONS + Constants.Dependencies.Versions.JAVAX_ANNOTATIONS, "compileOnly");
addDependency(Constants.Dependencies.FORGE_RUNTIME + Constants.Dependencies.Versions.FORGE_RUNTIME, JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME);
addDependency(Constants.Dependencies.JAVAX_ANNOTATIONS + Constants.Dependencies.Versions.JAVAX_ANNOTATIONS, JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME);
}
postPopulationScheduler.accept(this::writeRemapClassPath);

View File

@@ -339,25 +339,6 @@ public class MinecraftPatchedProvider extends DependencyProvider {
copyAll(getExtension().getForgeUniversalProvider().getForge(), environment.patchedSrgJar.apply(this));
copyUserdevFiles(getExtension().getForgeUserdevProvider().getUserdevJar(), environment.patchedSrgJar.apply(this));
});
logger.lifecycle(":injecting loom classes into minecraft");
File injection = File.createTempFile("loom-injection", ".jar");
try (InputStream in = MinecraftProvider.class.getResourceAsStream("/inject/injection.jar")) {
FileUtils.copyInputStreamToFile(in, injection);
}
for (Environment environment : Environment.values()) {
String side = environment.side();
File target = environment.patchedSrgJar.apply(this);
walkFileSystems(injection, target, it -> {
if (it.getFileName().toString().equals("MANIFEST.MF")) {
return false;
}
return getExtension().useFabricMixin || !it.getFileName().toString().endsWith("cpw.mods.modlauncher.api.ITransformationService");
}, this::copyReplacing);
}
}
private void accessTransformForge(Logger logger) throws Exception {

View File

@@ -91,6 +91,7 @@ public class Constants {
public static final String TERMINAL_CONSOLE_APPENDER = "net.minecrell:terminalconsoleappender:";
public static final String JETBRAINS_ANNOTATIONS = "org.jetbrains:annotations:";
public static final String JAVAX_ANNOTATIONS = "com.google.code.findbugs:jsr305:"; // I hate that I have to add these.
public static final String FORGE_RUNTIME = "dev.architectury:architectury-loom-forge-runtime:";
private Dependencies() {
}
@@ -104,6 +105,7 @@ public class Constants {
public static final String TERMINAL_CONSOLE_APPENDER = "1.2.0";
public static final String JETBRAINS_ANNOTATIONS = "19.0.0";
public static final String JAVAX_ANNOTATIONS = "3.0.2";
public static final String FORGE_RUNTIME = "$LOOM_VERSION"; // replaced with current version at build time
private Versions() {
}