Search in sources :

Example 1 with FileCopyDetails

use of org.gradle.api.file.FileCopyDetails in project spring-boot by spring-projects.

the class BootArchiveSupport method createCopyAction.

CopyAction createCopyAction(Jar jar, LayerResolver layerResolver, String layerToolsLocation) {
    File output = jar.getArchiveFile().get().getAsFile();
    Manifest manifest = jar.getManifest();
    boolean preserveFileTimestamps = jar.isPreserveFileTimestamps();
    boolean includeDefaultLoader = isUsingDefaultLoader(jar);
    Spec<FileTreeElement> requiresUnpack = this.requiresUnpack.getAsSpec();
    Spec<FileTreeElement> exclusions = this.exclusions.getAsExcludeSpec();
    LaunchScriptConfiguration launchScript = this.launchScript;
    Spec<FileCopyDetails> librarySpec = this.librarySpec;
    Function<FileCopyDetails, ZipCompression> compressionResolver = this.compressionResolver;
    String encoding = jar.getMetadataCharset();
    CopyAction action = new BootZipCopyAction(output, manifest, preserveFileTimestamps, includeDefaultLoader, layerToolsLocation, requiresUnpack, exclusions, launchScript, librarySpec, compressionResolver, encoding, layerResolver);
    return jar.isReproducibleFileOrder() ? new ReproducibleOrderingCopyAction(action) : action;
}
Also used : CopyAction(org.gradle.api.internal.file.copy.CopyAction) FileTreeElement(org.gradle.api.file.FileTreeElement) FileCopyDetails(org.gradle.api.file.FileCopyDetails) Manifest(org.gradle.api.java.archives.Manifest) File(java.io.File)

Example 2 with FileCopyDetails

use of org.gradle.api.file.FileCopyDetails in project webpieces by deanhiller.

the class TemplateCompilerPlugin method createProcessResourcesTask.

private void createProcessResourcesTask(SourceSet sourceSet, SourceDirectorySet resourceSet, Project project) {
    TaskProvider<Copy> copyTemplatesTask = project.getTasks().register(sourceSet.getProcessResourcesTaskName() + "Templates", Copy.class, (resourcesTask) -> {
        File fromDir = new File("src/" + sourceSet.getName() + "/java");
        File toDir = new File(project.getBuildDir(), "resources/" + sourceSet.getName());
        resourcesTask.from(fromDir).include("**/*.html", "**/*.tag", "**/*.json");
        resourcesTask.into(toDir);
        resourcesTask.eachFile(new Action<FileCopyDetails>() {

            @Override
            public void execute(FileCopyDetails fileCopyDetails) {
                log.log(LogLevel.INFO, "copying file=" + fileCopyDetails.getPath() + " from=" + fileCopyDetails.getSourcePath());
            }
        });
        resourcesTask.setDescription("Processes " + resourceSet + ".");
    });
    this.project.getTasks().named(sourceSet.getProcessResourcesTaskName(), (task) -> {
        task.dependsOn(new Object[] { copyTemplatesTask });
    });
}
Also used : FileCopyDetails(org.gradle.api.file.FileCopyDetails) File(java.io.File)

Aggregations

File (java.io.File)2 FileCopyDetails (org.gradle.api.file.FileCopyDetails)2 FileTreeElement (org.gradle.api.file.FileTreeElement)1 CopyAction (org.gradle.api.internal.file.copy.CopyAction)1 Manifest (org.gradle.api.java.archives.Manifest)1