ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Rees <d.ree...@usa.net>
Subject Re: Filter task feels wrong
Date Thu, 08 Mar 2001 01:14:20 GMT
yes, i agree completely

On Thu, 8 Mar 2001 11:21:46 +1030 (CST), Barrie Treloar wrote:

>Has anyone noticed that the filter task feels wrong?
>
>I'll use the target build from Ant's build.xml file.
>Heres the excerpt:
>
>    <filter token="VERSION" value="${version}" />
>    <filter token="DATE" value="${TODAY}" />
>    <filter token="TIME" value="${TSTAMP}" />
>    <copy    todir="${build.classes}" 
>             overwrite="true"
>             filtering="on">
>      <fileset dir="${java.dir}">
>        <include name="**/version.txt" />
>        <include name="**/defaultManifest.mf" />
>      </fileset>
>    </copy>
>
>    <copy todir="${build.classes}/${optional.package}/junit">
>       <fileset dir="${java.dir}/${optional.package}/junit">
>         <include name="html/**" />
>         <include name="xsl/**" />
>       </fileset>
>    </copy>
>
>The filter tasks turn on the filtering for the VERSION, DATE, TIME
>values so that the copying of the classes for Ant get set with the
>correct values.
>
>However this also turns on filtering for the copying of the juni
>documentation. 
>
>Is this really what is meant to happen?
>
>Also if I was to run two targets "build" and
>"Some_Copies_In_This_Target" then I would inherit the filter values
>set from the "build" target.
>
>What I think we want to do is scope the filtering so that it occurs
>only in the copy that has the filtering enabled and for the correct
>tokens.
>
>Since filtering is only relevant to the copy task, it should be a
>child element of copy.  To reduce typing we may need references to a
>filter.  Filter should not have attributes it should instead of child
>elements.
>
>So it would like something like:
>
>    <copy    todir="${build.classes}" 
>             overwrite="true"
>             filtering="on">
>      <filter id="ant.tokens">
>          <token="VERSION" value="${version}" />
>          <token="DATE" value="${TODAY}" />
>          <token="TIME" value="${TSTAMP}" />
>      </filter>
>      <fileset dir="${java.dir}">
>        <include name="**/version.txt" />
>        <include name="**/defaultManifest.mf" />
>      </fileset>
>    </copy>
>
>
>
>Barrie


Mime
View raw message