Merge branch '2.7.x'

This commit is contained in:
Andy Wilkinson
2022-03-02 15:24:23 +00:00
5 changed files with 73 additions and 74 deletions

View File

@@ -179,19 +179,10 @@ class BootArchiveSupport {
}
void moveModuleInfoToRoot(CopySpec spec) {
spec.filesMatching("module-info.class", BootArchiveSupport::moveToRoot);
spec.filesMatching("module-info.class", this::moveToRoot);
}
void moveMetaInfToRoot(CopySpec spec) {
spec.eachFile((file) -> {
String path = file.getRelativeSourcePath().getPathString();
if (path.startsWith("META-INF/") && !path.equals("META-INF/aop.xml") && !path.endsWith(".kotlin_module")) {
moveToRoot(file);
}
});
}
private static void moveToRoot(FileCopyDetails details) {
void moveToRoot(FileCopyDetails details) {
details.setRelativePath(details.getRelativeSourcePath());
}

View File

@@ -95,7 +95,7 @@ public class BootJar extends Jar implements BootArchive {
bootInfSpec.into("classes", fromCallTo(this::classpathDirectories));
bootInfSpec.into("lib", fromCallTo(this::classpathFiles)).eachFile(this.support::excludeNonZipFiles);
this.support.moveModuleInfoToRoot(bootInfSpec);
this.support.moveMetaInfToRoot(bootInfSpec);
moveMetaInfToRoot(bootInfSpec);
}
private Iterable<File> classpathDirectories() {
@@ -110,6 +110,15 @@ public class BootJar extends Jar implements BootArchive {
return (this.classpath != null) ? this.classpath.filter(filter) : Collections.emptyList();
}
private void moveMetaInfToRoot(CopySpec spec) {
spec.eachFile((file) -> {
String path = file.getRelativeSourcePath().getPathString();
if (path.startsWith("META-INF/") && !path.equals("META-INF/aop.xml") && !path.endsWith(".kotlin_module")) {
this.support.moveToRoot(file);
}
});
}
@Override
public void copy() {
this.support.configureManifest(getManifest(), getMainClass().get(), CLASSES_DIRECTORY, LIB_DIRECTORY,

View File

@@ -80,7 +80,6 @@ public class BootWar extends War implements BootArchive {
this.layered = project.getObjects().newInstance(LayeredSpec.class);
getWebInf().into("lib-provided", fromCallTo(this::getProvidedLibFiles));
this.support.moveModuleInfoToRoot(getRootSpec());
this.support.moveMetaInfToRoot(getRootSpec());
getRootSpec().eachFile(this.support::excludeNonZipLibraryFiles);
project.getConfigurations().all((configuration) -> {
ResolvableDependencies incoming = configuration.getIncoming();