ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose Alberto Fernandez <>
Subject RE: Proposed refactoring of scanDir() functionality
Date Mon, 06 Nov 2000 22:46:39 GMT
> From: Stefan Bodewig []
> Thinking further, we shouldn't introduce magic characters here,
> instead of a single "argument" attribute, it should better be 
> separated,
> something like
> <mapper type="glob" from="*.oldext" to="*.newext" /> 
> <mapper type="regexp" from="strip/this/(.+)\.oldext$" 
> to="\1.newext" /> 
> <mapper type="merge" from="*" to="" /> 
> with from and to being optional (the "merge" type above wouldn't need
> a "from" and something like type="identity" doesn't need arguments at
> all).

Do you have any ideas on how to specify 1 to many mappers? Or is your
syntax not usefull for that?

 <mapper type="regexp" from="(.+)\.java" >
   <map to="\" />
   <map to="\" />

This would be a possible solution, but not sure...

> BTW the example above leads me to think FileNameMapper needs a way to
> say skipThis, in the glob example it doesn't know how to handle files
> that don't end with ".oldext". Of course we could throw a
> BuildException and force users to set the correct <include> patterns
> as well (which would make it even more explicit).

I do not like to much having to make another call for each file, one to
if I should pass the String and another to pass the string.

Returning null to mean nothing to map to (which is equivalent to skip)
sounds fine. I wouldn't just throw a BuildException, maybe some subclass
of BuildException, NoMappingException, and being able to instruct the 
scanner instance whether to continue/abort when this happens.

Jose Alberto

> Stefan

View raw message