Shade tiny mappings parser inside the injection jar, add launch property for the mapping path

This commit is contained in:
Juuxel
2020-11-30 21:13:10 +02:00
parent 76a171556e
commit 702cf11d33
5 changed files with 16 additions and 6 deletions

View File

@@ -6,6 +6,7 @@ plugins {
id 'eclipse'
id 'groovy'
id 'checkstyle'
id 'com.github.johnrengelman.shadow' version '4.0.4'
}
sourceCompatibility = 1.8
@@ -24,6 +25,12 @@ if (ENV.BUILD_NUMBER) {
version = baseVersion + '-forge.28'
}
configurations {
forgeInjectShadow
forgeInjectCompileClasspath.extendsFrom(forgeInjectShadow)
forgeInjectRuntimeClasspath.extendsFrom(forgeInjectShadow)
}
sourceSets {
forgeInject
}
@@ -84,7 +91,7 @@ dependencies {
implementation ('net.minecraftforge.gradle:ForgeGradle:3.0.179')
// Forge injection
forgeInjectImplementation ('net.fabricmc:tiny-mappings-parser:0.2.2.14') // TODO: Shade this
forgeInjectShadow ('net.fabricmc:tiny-mappings-parser:0.2.2.14')
forgeInjectImplementation ('cpw.mods:modlauncher:6.1.3')
// Testing
@@ -94,7 +101,8 @@ dependencies {
}
}
task forgeInjectJar(type: Jar, dependsOn: [compileForgeInjectJava, processForgeInjectResources]) {
task forgeInjectJar(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar, dependsOn: [compileForgeInjectJava, processForgeInjectResources]) {
configurations = [project.configurations.forgeInjectShadow]
classifier = 'forgeinject'
from compileForgeInjectJava.outputs
from processForgeInjectResources.outputs

View File

@@ -69,7 +69,7 @@ public class YarnNamingService implements INameMappingService {
}
String pathStr = System.getProperty("loom.srgtoyarn.path");
if (pathStr == null) throw new RuntimeException("Missing system property 'loom.srgtoyarn.path'!");
if (pathStr == null) throw new RuntimeException("Missing system property 'fabric.yarnWithSrg.path'!");
Path path = Paths.get(pathStr);
try (BufferedReader reader = Files.newBufferedReader(path)) {

View File

@@ -70,6 +70,8 @@ public class LaunchProvider extends DependencyProvider {
if (getExtension().isForge()) {
launchConfig
.property("fabric.yarnWithSrg.path", getExtension().getMappingsProvider().tinyMappingsWithSrg.toAbsolutePath().toString())
.argument("--fml.mcVersion")
.argument(getExtension().getMinecraftProvider().getMinecraftVersion())
.argument("--fml.forgeVersion")

View File

@@ -78,7 +78,7 @@ public class MappingsProvider extends DependencyProvider {
public File tinyMappings;
public File tinyMappingsJar;
public File mappingsMixinExport;
private Path tinyMappingsWithSrg;
public Path tinyMappingsWithSrg;
public MappingsProvider(Project project) {
super(project);

View File

@@ -290,8 +290,8 @@ public class MinecraftProvider extends DependencyProvider {
FileUtils.copyInputStreamToFile(in, injection);
}
copyAll(injection, minecraftClientPatchedSrgJar);
copyAll(injection, minecraftServerPatchedSrgJar);
walkFileSystems(injection, minecraftClientPatchedSrgJar, it -> !it.getFileName().toString().equals("MANIFEST.MF"), this::copyReplacing);
walkFileSystems(injection, minecraftServerPatchedSrgJar, it -> !it.getFileName().toString().equals("MANIFEST.MF"), this::copyReplacing);
}
private void remapPatchedJars(Logger logger) throws IOException {