* copy non-java files into remapped sources jar * Simplify isJavaFile * remove unused import * Use path API
This commit is contained in:
parent
5ab5097b4d
commit
7c6e9a37c0
1 changed files with 22 additions and 0 deletions
|
@ -135,6 +135,8 @@ public class SourceRemapper {
|
|||
project.getLogger().warn("Could not remap " + source.getName() + " fully!", e);
|
||||
}
|
||||
|
||||
copyNonJavaFiles(srcPath, dstPath, project, source);
|
||||
|
||||
if (dstFs != null) {
|
||||
dstFs.close();
|
||||
}
|
||||
|
@ -142,8 +144,28 @@ public class SourceRemapper {
|
|||
if (isSrcTmp) {
|
||||
Files.walkFileTree(srcPath, new DeletingFileVisitor());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void copyNonJavaFiles(Path from, Path to, Project project, File source) throws IOException {
|
||||
Files.walk(from).forEach(path -> {
|
||||
Path targetPath = to.resolve(from.relativize(path).toString());
|
||||
if (!isJavaFile(path) && !Files.exists(targetPath)) {
|
||||
try {
|
||||
Files.copy(path, targetPath);
|
||||
} catch (IOException e) {
|
||||
project.getLogger().warn("Could not copy non-java sources '" + source.getName() + "' fully!", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static boolean isJavaFile(Path path) {
|
||||
String name = path.getFileName().toString();
|
||||
// ".java" is not a valid java file
|
||||
return name.endsWith(".java") && name.length() != 5;
|
||||
}
|
||||
|
||||
public static class TinyReader extends MappingsReader {
|
||||
private final Mappings m;
|
||||
private final String from, to;
|
||||
|
|
Loading…
Reference in a new issue