From 35802a86fb020a62457297a35084bb46364ff265 Mon Sep 17 00:00:00 2001 From: Abel Salgado Romero Date: Sun, 28 Aug 2022 20:43:51 +0200 Subject: [PATCH] Remove unnecessary mapResources method Leftover from #597 --- .../org/asciidoctor/maven/AsciidoctorMojo.java | 16 ---------------- ...esourceCopyFileAlterationListenerAdaptor.java | 6 ++---- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/asciidoctor-maven-plugin/src/main/java/org/asciidoctor/maven/AsciidoctorMojo.java b/asciidoctor-maven-plugin/src/main/java/org/asciidoctor/maven/AsciidoctorMojo.java index 5605d5ce..c5b489a2 100644 --- a/asciidoctor-maven-plugin/src/main/java/org/asciidoctor/maven/AsciidoctorMojo.java +++ b/asciidoctor-maven-plugin/src/main/java/org/asciidoctor/maven/AsciidoctorMojo.java @@ -259,22 +259,6 @@ private boolean isRelativePath(String candidateName) { return candidateName.startsWith("./") || candidateName.startsWith(".\\"); } - public static List mapResources(List resources) { - if (resources == null || resources.isEmpty()) - return Collections.emptyList(); - - return resources.stream() - .map(mojoResource -> { - org.apache.maven.model.Resource resource = new org.apache.maven.model.Resource(); - resource.setDirectory(mojoResource.getDirectory()); - resource.setTargetPath(mojoResource.getTargetPath()); - resource.setIncludes(mojoResource.getIncludes()); - resource.setExcludes(mojoResource.getExcludes()); - return resource; - }) - .collect(Collectors.toList()); - } - /** * Updates optionsBuilder's baseDir and toDir accordingly to the conversion configuration. * diff --git a/asciidoctor-maven-plugin/src/main/java/org/asciidoctor/maven/refresh/ResourceCopyFileAlterationListenerAdaptor.java b/asciidoctor-maven-plugin/src/main/java/org/asciidoctor/maven/refresh/ResourceCopyFileAlterationListenerAdaptor.java index 99bf46c0..e7b5087d 100644 --- a/asciidoctor-maven-plugin/src/main/java/org/asciidoctor/maven/refresh/ResourceCopyFileAlterationListenerAdaptor.java +++ b/asciidoctor-maven-plugin/src/main/java/org/asciidoctor/maven/refresh/ResourceCopyFileAlterationListenerAdaptor.java @@ -1,8 +1,8 @@ package org.asciidoctor.maven.refresh; -import org.apache.maven.model.Resource; import org.apache.maven.plugin.logging.Log; import org.asciidoctor.maven.AsciidoctorRefreshMojo; +import org.asciidoctor.maven.model.Resource; import org.codehaus.plexus.util.DirectoryScanner; import org.codehaus.plexus.util.FileUtils; @@ -12,7 +12,6 @@ import java.util.List; import java.util.stream.Collectors; -import static org.asciidoctor.maven.AsciidoctorMojo.mapResources; import static org.asciidoctor.maven.commons.StringUtils.isBlank; public class ResourceCopyFileAlterationListenerAdaptor extends AbstractFileAlterationListenerAdaptor { @@ -30,8 +29,7 @@ synchronized void processFile(File file, String actionName) { final File sourceDirectory = mojo.findSourceDirectory(mojo.getSourceDirectory(), mojo.getBaseDir()).get(); final File outputDirectory = mojo.getOutputDirectory(); - final List resources = mapResources(mojo.getResources()); - List matchingResources = findMatchingResources(resources, file); + final List matchingResources = findMatchingResources(mojo.getResources(), file); if (matchingResources.isEmpty()) { final String relativePath = file.getParentFile().getCanonicalPath().substring(sourceDirectory.getCanonicalPath().length()); final File destinationDirectory = new File(outputDirectory, relativePath);