@@ -22,8 +22,8 @@ protected MetaInfFixer() {}
2222 @ Override
2323 public boolean canTransform (TinyRemapper remapper , Path relativePath ) {
2424 return shouldStripForFixMeta (relativePath ) ||
25- relativePath .getFileName ().toString ().equals ("MANIFEST.MF" ) ||
26- (remapper != null && relativePath .getNameCount () == 3 && relativePath .getName (1 ).toString ().equals ("services" ));
25+ relativePath .getFileName ().toString ().equals ("MANIFEST.MF" ) ||
26+ (remapper != null && relativePath .getNameCount () == 3 && relativePath .getName (1 ).toString ().equals ("services" ));
2727 }
2828
2929 @ Override
@@ -42,10 +42,12 @@ public void transform(Path destinationDirectory, Path relativePath, InputStream
4242 manifest .write (os );
4343 }
4444 } else if (remapper != null && relativePath .getNameCount () == 3 && relativePath .getName (1 ).toString ().equals ("services" )) {
45- fileName = mapFullyQualifiedClassName (fileName , remapper );
46- Path newFile = destinationDirectory .resolve (relativePath ).getParent ().resolve (fileName );
45+ Path outputDir = destinationDirectory .resolve (relativePath ).getParent ();
46+ Files .createDirectories (outputDir );
47+ Path outputFile = outputDir .resolve (mapFullyQualifiedClassName (fileName , remapper ));
48+
4749 try (BufferedReader reader = new BufferedReader (new InputStreamReader (input ));
48- BufferedWriter writer = Files .newBufferedWriter (newFile , StandardOpenOption .CREATE , StandardOpenOption .TRUNCATE_EXISTING , StandardOpenOption .WRITE )) {
50+ BufferedWriter writer = Files .newBufferedWriter (outputFile , StandardOpenOption .CREATE , StandardOpenOption .TRUNCATE_EXISTING , StandardOpenOption .WRITE )) {
4951 fixServiceDecl (reader , writer , remapper );
5052 }
5153 }
@@ -60,9 +62,9 @@ private static boolean shouldStripForFixMeta(Path file) {
6062
6163 // https://docs.oracle.com/en/java/javase/12/docs/specs/jar/jar.html#signed-jar-file
6264 return fileName .endsWith (".SF" )
63- || fileName .endsWith (".DSA" )
64- || fileName .endsWith (".RSA" )
65- || fileName .startsWith ("SIG-" );
65+ || fileName .endsWith (".DSA" )
66+ || fileName .endsWith (".RSA" )
67+ || fileName .startsWith ("SIG-" );
6668 }
6769
6870 private static String mapFullyQualifiedClassName (String name , TinyRemapper remapper ) {
0 commit comments