Merge branch '2.1.x'

This commit is contained in:
Andy Wilkinson 2019-02-12 16:42:15 +00:00
commit 0adea5a905
2 changed files with 19 additions and 1 deletions

View File

@ -380,7 +380,8 @@ public class Repackager {
return null;
}
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().equals("module-info.class")) {
return entry;

View File

@ -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 {
TestJarFile library = new TestJarFile(this.temporaryFolder);
library.addClass("com/example/library/Library.class",