Repackage kotlin-module metadata beneath BOOT-INF/classes
Closes gh-15890
This commit is contained in:
parent
3a6d15acf6
commit
948bafa4d8
|
@ -380,7 +380,8 @@ public class Repackager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ((entry.getName().startsWith("META-INF/")
|
if ((entry.getName().startsWith("META-INF/")
|
||||||
&& !entry.getName().equals("META-INF/aop.xml"))
|
&& !entry.getName().equals("META-INF/aop.xml")
|
||||||
|
&& !entry.getName().endsWith(".kotlin-module"))
|
||||||
|| entry.getName().startsWith("BOOT-INF/")
|
|| entry.getName().startsWith("BOOT-INF/")
|
||||||
|| entry.getName().equals("module-info.class")) {
|
|| entry.getName().equals("module-info.class")) {
|
||||||
return entry;
|
return entry;
|
||||||
|
|
|
@ -675,6 +675,23 @@ public class RepackagerTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void kotlinModuleMetadataMovesBeneathBootInfClassesWhenRepackaged()
|
||||||
|
throws Exception {
|
||||||
|
this.testJarFile.addClass("A.class", ClassWithMainMethod.class);
|
||||||
|
this.testJarFile.addFile("META-INF/test.kotlin-module",
|
||||||
|
this.temporaryFolder.newFile("test.kotlin-module"));
|
||||||
|
File source = this.testJarFile.getFile();
|
||||||
|
File dest = this.temporaryFolder.newFile("dest.jar");
|
||||||
|
Repackager repackager = new Repackager(source);
|
||||||
|
repackager.repackage(dest, NO_LIBRARIES);
|
||||||
|
try (JarFile jarFile = new JarFile(dest)) {
|
||||||
|
assertThat(jarFile.getEntry("META-INF/test.kotlin-module")).isNull();
|
||||||
|
assertThat(jarFile.getEntry("BOOT-INF/classes/META-INF/test.kotlin-module"))
|
||||||
|
.isNotNull();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private File createLibrary() throws IOException {
|
private File createLibrary() throws IOException {
|
||||||
TestJarFile library = new TestJarFile(this.temporaryFolder);
|
TestJarFile library = new TestJarFile(this.temporaryFolder);
|
||||||
library.addClass("com/example/library/Library.class",
|
library.addClass("com/example/library/Library.class",
|
||||||
|
|
Loading…
Reference in New Issue