Skip to content

Commit

Permalink
Remove unnecessary mapResources method
Browse files Browse the repository at this point in the history
Leftover from asciidoctor#597
  • Loading branch information
abelsromero committed Aug 28, 2022
1 parent b6c6db6 commit 35802a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,22 +259,6 @@ private boolean isRelativePath(String candidateName) {
return candidateName.startsWith("./") || candidateName.startsWith(".\\");
}

public static List<org.apache.maven.model.Resource> mapResources(List<Resource> 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.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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 {
Expand All @@ -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<Resource> resources = mapResources(mojo.getResources());
List<Resource> matchingResources = findMatchingResources(resources, file);
final List<Resource> 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);
Expand Down

0 comments on commit 35802a8

Please sign in to comment.