You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by ry...@mediumone.com on 2001/10/01 18:14:25 UTC

Transforming/mapping filesets

Hi,

I'm trying to figure out how to create a fileset based on a mapping of
another fileset. I've run this by the ant-user list (with no response yet),
so I guess this would be something I'd have to develop myself. (?)

A scenario where this is useful:
I could create a fileset containing all the .foo source files in the current
directory. I could then create some sort of build process by which a target
file "asdf" is built from the "asdf.foo" source.

I would like to be able to have a "clean" target that deletes the target
files. I'd like to do something along the lines of the following:

<target name="clean">
<delete>
<fileset dir=".">
<fileset dir="." includes="*.foo"/>
<mapper type="glob" from="*.foo" to="*"/>
</fileset>
</delete>
</target>

That is, create a fileset that contains all the .foo files stripped of
their.foo extension, and use that in the "delete" task.

Is there a way to do this now? Is this a sensible feature?

TIA,

Ryan.



Re: Transforming/mapping filesets

Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 1 Oct 2001, <ry...@mediumone.com> wrote:

> Is there a way to do this now?

I first thought you could get away with <apply> (at the cost of
portability), something like

<apply executable="rm">
  <srcfile />

  <fileset dir="." excludes="*.foo" />
  <mapper type="glob" from="*" to="*.foo" />
</apply>

could work - this will delete all files not ending with .foo where no
corresponding .foo file can be found or .foo is older than the file in
question.  As long as there are only .foo files in the directory and
nothing else (after the cleanup) this could work.  Looks a little
dangerous.

> Is this a sensible feature?

It has been asked for before and we are planning to enhance the whole
<fileset> stuff to allow to build fileset based on other predicates,
not just pattern matching (readable files, files modified before a
given date and so on) - using some kind of mapper predicate fits into
this very vague picture as well.

Stefan