ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@bost.de>
Subject Re: Proposed refactoring of scanDir() functionality
Date Mon, 06 Nov 2000 08:55:24 GMT
>>>>> "JAF" == Jose Alberto Fernandez <JFernandez@viquity.com> writes:

 JAF> +1 But please do not use static methods.

Agreed.

 JAF> It would be also nice if different statages of the scanning
 JAF> process are defined in protected methods that can be overrided
 JAF> by subclasses in the future.

I'd expect most everything to happen in the FileNameMapper. But then,
maybe I should think about that again.

One thing I don't have a clear picture of now is where to put a "skip
this file" logic. Sometimes include/exclude based on filenames it not
enough, take rmic's verify attribute for example that can be used to
skip all classes that do not implement Remote.

Should the FileNameMapper for rmic simply return an empty array (or
null) if the class corresponding class doesn't implement Remote?

Should the ScanDir class have a "boolean skipThisFile(...)" method
that could be overridden by a version for rmic that does the check?

 >>  <move fromdir todir> 
 >>    <mapper type="glob" argument="*.oldext/*.newext" /> 
 >>  </move>

 JAF> I lile the concept of a mapper as a datatype.  So that they can
 JAF> be declared like filesets.

Yep. 

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="archive.zip" /> 

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).

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).

Stefan

Mime
View raw message