ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: prepend file to multiple files
Date Tue, 16 Sep 2003 14:36:47 GMT

Jan example shows the configuration of his custom filterReader "à la Ant
1.5", instead of the new Ant 1.6 one, where you can do (I believe):

<project name="test">
  <typedef name="concat" 
           classname="org.apache.tools.ant.filters.ConcatReader" />

  <delete dir="to" />
  <copy todir="to">
    <fileset dir="src" includes="*.java">
      <filterchain>
        <concat before="license.java.txt" />
      </filterchain>
    </fileset>
  </copy>

  <copy todir="to">
    <fileset dir="src" includes="*.html">
      <filterchain>
        <concat after="license.html.txt" />
      </filterchain>
    </fileset>
  </copy>
</project>

That shows:
1) basedir="." is implied (in Ant .1.5 too BTW)
2) Top-level tasks, so no need for a target.
3) Ability to typedef any bean, and use it using the add(FilterReader)
   new Introspection point.
4) That it uses a real String->File conversion, instead of a <param>, which
   must be explicitly qualified with ${basedir} to be relative to the
   build's basedir.

I'm assuming FilterChain has been extended by Peter of course. --DD

> -----Original Message-----
> From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <project name="test" basedir="." default="main">
>     <target name="main">
>         <delete dir="to"/>
>         <copy todir="to">
>             <fileset dir="src" includes="*.java"/>
>             <filterchain>
>                 <filterreader
> classname="org.apache.tools.ant.filters.ConcatReader">
>                     <param name="before" value="license.java.txt"/>
>                 </filterreader>
>             </filterchain>
>         </copy>
>         <copy todir="to">
>             <fileset dir="src" includes="*.html"/>
>             <filterchain>
>                 <filterreader
> classname="org.apache.tools.ant.filters.ConcatReader">
>                     <param name="after" value="license.html.txt"/>
>                 </filterreader>
>             </filterchain>
>         </copy>
>     </target>
> </project>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message