This is the default FileNameMapper for the archiving tasks and + * uptodate.
+ * + * @author Stefan Bodewig + */ +public class MergingMapper implements FileNameMapper { + protected String[] mergedFile = null; + + /** + * Ignored. + */ + public void setFrom(String from) {} + + /** + * Sets the name of the merged file. + */ + public void setTo(String to) { + mergedFile = new String[] {to}; + } + + /** + * Returns an one-element array containing the file name set via setTo. + */ + public String[] mapFileName(String sourceFileName) { + return mergedFile; + } + +} diff --git a/src/main/org/apache/tools/ant/util/SourceFileScanner.java b/src/main/org/apache/tools/ant/util/SourceFileScanner.java index ac2d12fc7..8ce61ffca 100644 --- a/src/main/org/apache/tools/ant/util/SourceFileScanner.java +++ b/src/main/org/apache/tools/ant/util/SourceFileScanner.java @@ -87,7 +87,8 @@ public class SourceFileScanner { * * @param files the original set of files * @param srcDir all files are relative to this directory - * @param destDir target files live here + * @param destDir target files live here. if null file names + * returned by the mapper are assumed to be absolute. * @param mapper knows how to construct a target file names from * source file names. */ @@ -116,7 +117,13 @@ public class SourceFileScanner { boolean added = false; targetList.setLength(0); for (int j=0; !added && j