diff --git a/pom.xml b/pom.xml index d563a4b5..ef5bae72 100644 --- a/pom.xml +++ b/pom.xml @@ -24,8 +24,8 @@ - 2.109-20180221.170307-1 - 2.109-20180221.170329-1 + 2.109-20180221.200457-2 + 2.109-20180221.200518-2 8 diff --git a/src/main/java/hudson/plugins/copyartifact/CopyArtifact.java b/src/main/java/hudson/plugins/copyartifact/CopyArtifact.java index 29e77257..74c605d9 100644 --- a/src/main/java/hudson/plugins/copyartifact/CopyArtifact.java +++ b/src/main/java/hudson/plugins/copyartifact/CopyArtifact.java @@ -59,7 +59,7 @@ import java.security.DigestOutputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; @@ -90,8 +90,6 @@ import org.apache.commons.io.IOUtils; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.types.selectors.SelectorUtils; -import org.apache.tools.ant.types.selectors.TokenizedPath; -import org.apache.tools.ant.types.selectors.TokenizedPattern; /** * Build step to copy artifacts from another project. @@ -544,7 +542,7 @@ private boolean perform(Run src, Run dst, String expandedFilter, @CheckForN } try { targetDir.mkdirs(); // Create target if needed - List list = scan(srcDir, expandedFilter, expandedExcludes); + Collection list = srcDir.list(expandedFilter.replace('\\', '/'), expandedExcludes != null ? expandedExcludes.replace('\\', '/') : null, false); for (String file : list) { copyOne(src, dst, fingerprints, srcDir.child(file), new FilePath(targetDir, isFlatten() ? file.replaceFirst(".+/", "") : file), md5); } @@ -569,27 +567,6 @@ private boolean perform(Run src, Run dst, String expandedFilter, @CheckForN } } - private static List scan(VirtualFile root, String expandedFilter, @CheckForNull String expandedExcludes) throws IOException { - List r = new ArrayList<>(); - // TODO need VirtualFile.list(String, String, boolean) like FilePath offers - List patts = new ArrayList<>(); - if (expandedExcludes != null) { - for (String patt : expandedExcludes.split(",")) { - patts.add(new TokenizedPattern(normalizePattern(patt))); - } - } - FILE: for (String child : root.list(expandedFilter)) { - child = child.replace('\\', '/'); // TODO list(String) ought to specify `/` as the separator - for (TokenizedPattern patt : patts) { - if (patt.matchPath(new TokenizedPath(child), true)) { - continue FILE; - } - } - r.add(child); - } - return r; - } - /** Similar to a method in {@link DirectoryScanner}. */ private static String normalizePattern(String p) { String pattern = p.replace('\\', '/'); // we only deal with forward slashes here diff --git a/src/test/java/hudson/plugins/copyartifact/CopyArtifactTest.java b/src/test/java/hudson/plugins/copyartifact/CopyArtifactTest.java index f51debd2..55a11b7a 100644 --- a/src/test/java/hudson/plugins/copyartifact/CopyArtifactTest.java +++ b/src/test/java/hudson/plugins/copyartifact/CopyArtifactTest.java @@ -543,7 +543,6 @@ public void testCopyFromWorkspace() throws Exception { assertFile(false, "c.log", b); } - @Ignore("TODO not yet (re-)implemented") @Issue("JENKINS-14900") @Test public void testCopyFromWorkspaceWithDefaultExcludes() throws Exception { @@ -574,7 +573,6 @@ public void testExcludes() throws Exception { assertFile(false, "foo.txt", b); } - @Ignore("TODO not yet (re-)implemented") @Issue("JENKINS-14900") @Test public void testCopyFromWorkspaceWithDefaultExcludesWithFlatten() throws Exception {