Hello Patrick, it is likely that it is too late for ant 1.8.1, unless the build of Friday does not pass the vote.
The other questions are ? What is the use case for this mapper ? Is it generic enough to be added to ant ? If it interesting we would need also patches of documentation and unit tests. Regards, Antoine -------- Original-Nachricht -------- > Datum: Sat, 1 May 2010 15:31:20 +0200 > Von: Patrick Martin <antu...@gmail.com> > An: Ant Dev <dev@ant.apache.org> > Betreff: Fwd: loop replace mapper > I guess I should have posted this mail on ant dev mailing list. > Is this request too late for ant 1.8.1 ? > > > ---------- Forwarded message ---------- > From: Patrick Martin <antu...@gmail.com> > Date: Sat, May 1, 2010 at 3:17 PM > Subject: loop replace mapper > To: Ant User <u...@ant.apache.org> > > > Hello, > > I wrote a small mapper which loops on a string list and replaces a > token in the input file name. > it can be used (since ant 1.8.1) like this: > <copy todir="test/data/destdir" > enablemultiplemappings="true"> > <fileset dir="test/data/srcdir" > includes="**" /> > <loopreplacemapper token="@dirname@" > list="dir1,dir2" /> > </copy> > <zip destfile="test/data/destzip.zip"> > <mappedresources > enablemultiplemappings="true"> > <fileset > dir="test/data/srcdir" includes="**" /> > <loopreplacemapper > token="@dirname@" > list="dir1,dir2" /> > </mappedresources> > </zip> > > Would this fit in the next standard ant version ? > > Here is the source code: > > public class LoopReplaceMapper implements FileNameMapper { > private String token; > private ArrayList<String> list; > > public void setToken(String token) { > this.token = token; > } > > public String getToken() { > return token; > } > > public void setList(String _list) { > StringTokenizer st = new StringTokenizer(_list, " > , "); > this.list = new > ArrayList<String>(st.countTokens()); > while (st.hasMoreTokens()) { > list.add(st.nextToken()); > } > } > > public String getList() { > return list.toString(); > } > > public String[] mapFileName(String sourceFileName) { > String[] mappedFileNames = null; > if (sourceFileName.contains(getToken())) { > mappedFileNames = new > String[list.size()]; > int index = 0; > for (String replacement : list) { > mappedFileNames[index++] = > sourceFileName.replace(getToken(), replacement); > } > } else { > mappedFileNames = new String[1]; > mappedFileNames[0] = sourceFileName; > } > return mappedFileNames; > } > > public void setFrom(String from) { > } > > public void setTo(String to) { > } > } > > Rgds, > > Patrick > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org