Add Library abstraction

Add a Library class update the LibraryCallback interface and
implementations to use it. This change is in preparation for
an addition `unpack` flag that will be required to allow the
automatic unpacking of certain nested jars.

See gh-1070
This commit is contained in:
Phillip Webb
2014-06-23 11:36:49 -07:00
parent 3d6c8a85f4
commit 5f8fbfd73a
9 changed files with 89 additions and 18 deletions

View File

@@ -23,6 +23,7 @@ import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.file.FileCollection;
import org.springframework.boot.loader.tools.Libraries;
import org.springframework.boot.loader.tools.Library;
import org.springframework.boot.loader.tools.LibraryCallback;
import org.springframework.boot.loader.tools.LibraryScope;
@@ -97,7 +98,7 @@ class ProjectLibraries implements Libraries {
LibraryCallback callback) throws IOException {
if (files != null) {
for (File file: files) {
callback.library(file, scope);
callback.library(new Library(file, scope));
}
}
}

View File

@@ -28,8 +28,8 @@ import org.gradle.api.plugins.BasePlugin;
import org.gradle.api.tasks.bundling.Jar;
import org.springframework.boot.gradle.PluginFeatures;
import org.springframework.boot.gradle.SpringBootPluginExtension;
import org.springframework.boot.loader.tools.Library;
import org.springframework.boot.loader.tools.LibraryCallback;
import org.springframework.boot.loader.tools.LibraryScope;
import org.springframework.util.StringUtils;
/**
@@ -135,9 +135,8 @@ public class RepackagePluginFeatures implements PluginFeatures {
private void addLibraryDependencies(final RepackageTask task) {
try {
task.getLibraries().doWithLibraries(new LibraryCallback() {
@Override
public void library(File file, LibraryScope scope) throws IOException {
task.getInputs().file(file);
public void library(Library library) throws IOException {
task.getInputs().file(library.getFile());
}
});
}