Bug 48001

Summary: Document differences between tasks' usage of mappers in some fashion.
Product: Ant Reporter: Alexander Pogrebnyak <alex-pub.apache-ant>
Component: DocumentationAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: 1.7.1   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Alexander Pogrebnyak 2009-10-15 09:02:56 UTC
I am trying to create a shadow directory to keep the timestamps of the files in the original directory tree.

For this I have tried to use the <touch> task with fileset and a glob mapper.

    <mkdir dir="${shadow.dir}/>

    <touch mkdirs="true" verbose="true">
      <fileset dir="${orig.dir}"/>
      <globmapper handledirsep="true"

Based on the description of the <touch> task I should have a collection of empty files in ${shadow.dir} at the same level as original files in ${orig.dir}.

However no directory structure is created.
Using <pathconvert> with the same <fileset> and <mapper> produced a valid file list.
Comment 1 Matt Benson 2009-10-15 10:49:25 UTC
This is probably a manifestation of one of the slightly confusing things about Ant mappers.  Mappers generally apply to the "names" of resources, which, in the case of a fileset, would be the part of the path relative to the basedir.  Try changing your from attribute on your mapper to "*" and see whether that doesn't give the results you want.
Comment 2 Alexander Pogrebnyak 2009-10-15 12:41:56 UTC
(In reply to comment #1)
Thank you Matt.  Worked as a charm.

Could you explain, then, why <pathconvert> does not bulk at me, but produces totally expected output?

In fact, when I change to the same mapper in <pathconvert> I get the names in this format: "C:\test\shadow-dir/C:\test\orig-dir\file".  Is it a bug in <pathconvert> then?

Basically, what needed is a reliable way to test the results of mapping applied to a fileset.

So, can I ask as a resolution for this problem to update Ant manual for a <touch> task with an example of a fileset with a mapper?
Comment 3 Matt Benson 2009-10-15 12:56:32 UTC
It might be reasonable to come up with some more generic solution for documenting the differences in behavior among tasks using mappers.  This probably requires more analysis and should be taken to the dev@ant.apache.org mailing list.  Let's change the description of this bug report accordingly.
Comment 4 Alexander Pogrebnyak 2009-10-15 13:49:28 UTC
(In reply to comment #3)
Thank you guys, you rock!!!