Update BootJar to support Gradle's configuration cache
See gh-22922
This commit is contained in:
@@ -19,6 +19,7 @@ package org.springframework.boot.gradle.tasks.bundling;
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.Project;
|
||||
@@ -72,7 +73,7 @@ public class BootJar extends Jar implements BootArchive {
|
||||
* Creates a new {@code BootJar} task.
|
||||
*/
|
||||
public BootJar() {
|
||||
this.support = new BootArchiveSupport(LAUNCHER, this::isLibrary, this::resolveZipCompression);
|
||||
this.support = new BootArchiveSupport(LAUNCHER, new LibrarySpec(), new ZipCompressionResolver());
|
||||
this.bootInfSpec = getProject().copySpec().into("BOOT-INF");
|
||||
this.mainClass = getProject().getObjects().property(String.class);
|
||||
configureBootInfSpec(this.bootInfSpec);
|
||||
@@ -325,4 +326,22 @@ public class BootJar extends Jar implements BootArchive {
|
||||
return this.resolvedDependencies;
|
||||
}
|
||||
|
||||
private final class LibrarySpec implements Spec<FileCopyDetails> {
|
||||
|
||||
@Override
|
||||
public boolean isSatisfiedBy(FileCopyDetails details) {
|
||||
return isLibrary(details);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private final class ZipCompressionResolver implements Function<FileCopyDetails, ZipCompression> {
|
||||
|
||||
@Override
|
||||
public ZipCompression apply(FileCopyDetails details) {
|
||||
return resolveZipCompression(details);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user