Rewrire Jar and Source remapping tasks. (#504)

This commit is contained in:
modmuss50
2021-12-20 16:29:11 +00:00
committed by GitHub
parent 5a16440c1e
commit ab21e0e550
36 changed files with 1154 additions and 1423 deletions

View File

@@ -37,6 +37,7 @@ import org.cadixdev.lorenz.MappingSet;
import org.cadixdev.mercury.Mercury;
import org.cadixdev.mercury.remapper.MercuryRemapper;
import org.gradle.api.Project;
import org.slf4j.Logger;
import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
@@ -142,7 +143,7 @@ public class SourceRemapper {
project.getLogger().warn("Could not remap " + source.getName() + " fully!", e);
}
copyNonJavaFiles(srcPath, dstPath, project, source);
copyNonJavaFiles(srcPath, dstPath, project.getLogger(), source.toPath());
if (dstFs != null) {
dstFs.close();
@@ -202,7 +203,7 @@ public class SourceRemapper {
return mercury;
}
private static void copyNonJavaFiles(Path from, Path to, Project project, File source) throws IOException {
public static void copyNonJavaFiles(Path from, Path to, Logger logger, Path source) throws IOException {
Files.walk(from).forEach(path -> {
Path targetPath = to.resolve(from.relativize(path).toString());
@@ -210,7 +211,7 @@ public class SourceRemapper {
try {
Files.copy(path, targetPath);
} catch (IOException e) {
project.getLogger().warn("Could not copy non-java sources '" + source.getName() + "' fully!", e);
logger.warn("Could not copy non-java sources '" + source + "' fully!", e);
}
}
});