ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barrie Treloar <Barrie.Trel...@camtech.com.au>
Subject Filter task feels wrong
Date Thu, 08 Mar 2001 00:51:46 GMT
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
--
Barrie Treloar
____________________________________________________________________

  Barrie Treloar                      Phone: +61 8 8303 3300
  Senior Analyst/Programmer           Fax:   +61 8 8303 4403 
  Electronic Commerce Division        Email: barrie@camtech.com.au
  Camtech                             http://www.camtech.com.au
  A division of Keycorp Limited
 --- Level 8, 10 Pulteney Street, Adelaide SA 5000, Australia. ---
____________________________________________________________________



Mime
View raw message