On Thu, 20 Jan 2005, Dominique Devienne <[EMAIL PROTECTED]> wrote:

> Let me address the second one first:
> 
>> (2) Names again.
>> 
>>     <sync todir="${dest}">
>>       <fileset dir="${src}"/>
>>       <deletefromtarget>
>>         <exclude name="e/f"/>
>>       </deletefromtarget>
>>     </sync>
>> 
>> <deletefromtarget> is a <fileset> that doesn't allow dir to be
>> set.  It implicitly contains <exclude>s for all the files that
>> have been matched by one of the source-<fileset> (everything that
>> should be there).  It can be used to keep things like logfiles or
>> config files or similar in you target directory.  Default is to
>> delete everything not present in any of the source sets.
> 
> Why a dir-less fileset rather than a patternset/selector?

Because it is a very convenient SelectorContainer that also happens to
allow nested patternsets and even has a default patternset for very
compact descriptions.

> What happens if I refid a fileset with a dir? It barfs?

You can't since it is not a <fileset>, it is an AbstractFileSet.  The
only things you could pass in via refid are other deletefromtarget
instances as well (see AbstractFileSet#getRef()).

>> Now, is <deletefromtarget> a good name?  Is there a better one to
>> capture what it does?
> 
> I don't know... I was kind of thinking the reverse, where you
> specify files not to touch on the target side, like
> 
>       <preservedtargets>
>         <include name="e/f" />
>       </preservedtargets>

But that would have been significantly more difficult to code ;-)

> The advantage of this is you can do stuff like:
> 
>       <preservedtargets>
>         <include name="**/*.log" />
>         <exclude name="**/tmp/*.log" />
>       </preservedtargets>
> 
> Which you cannot do with the <exclude> logic.

But it enables things you couldn't do with preservetargets - exclude
and include are simply not symmetric.

> (although you can do it with selectors).

Yep.

> A 33% slowdown with your optimizations doesn't sound too bad
> for the added flexibility ;-)

Cool.

Thanks

        Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to