mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-30 05:05:20 -05:00
Fix merge conflicts
This commit is contained in:
@@ -267,6 +267,14 @@ public class RemapJarTask extends Jar {
|
||||
project.getLogger().debug("Transformed mixin reference maps in output JAR!");
|
||||
}
|
||||
|
||||
if (extension.isForge()) {
|
||||
try {
|
||||
remapRefmap(extension, output);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Failed to remap refmap jar", e);
|
||||
}
|
||||
}
|
||||
|
||||
if (getAddNestedDependencies().getOrElse(false)) {
|
||||
JarNester.nestJars(nestedJarProvider.provide(), output.toFile(), project.getLogger());
|
||||
}
|
||||
@@ -286,6 +294,40 @@ public class RemapJarTask extends Jar {
|
||||
});
|
||||
}
|
||||
|
||||
private void remapRefmap(LoomGradleExtension extension, Path output) throws IOException {
|
||||
try (FileSystem fs = FileSystems.newFileSystem(URI.create("jar:" + output.toUri()), ImmutableMap.of("create", false))) {
|
||||
Path refmapPath = fs.getPath(extension.getRefmapName());
|
||||
|
||||
if (Files.exists(refmapPath)) {
|
||||
try (Reader refmapReader = Files.newBufferedReader(refmapPath, StandardCharsets.UTF_8)) {
|
||||
Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();
|
||||
JsonObject refmapElement = gson.fromJson(refmapReader, JsonObject.class);
|
||||
refmapElement = RefmapRemapper.remap(new Remapper() {
|
||||
ReferenceRemapper remapper = createReferenceRemapper(extension, fromM.get(), toM.get());
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public MappingsRemapper remapMappings() {
|
||||
return className -> remapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Map.Entry<String, @Nullable MappingsRemapper> remapMappingsData(String data) {
|
||||
if (Objects.equals(data, "named:intermediary")) {
|
||||
return new AbstractMap.SimpleEntry<>("searge", remapMappings());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}, refmapElement);
|
||||
Files.delete(refmapPath);
|
||||
Files.write(refmapPath, gson.toJson(refmapElement).getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private NestedJarProvider getNestedJarProvider() {
|
||||
Configuration includeConfiguration = getProject().getConfigurations().getByName(Constants.Configurations.INCLUDE);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user