ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Don Taylor <donald_l_taylor...@yahoo.com>
Subject Re: Variables in task ?
Date Thu, 28 Jun 2001 12:47:44 GMT
Sure. Just do an antcall.

<target name="Recopie des images">
  <copy todir="${codes}/${paquetage}/${images}" >
    <fileset dir="${sources}/${paquetage}/${images}"/>
  </copy>
</target>

<target name="Recopie toutes des images">
  <antcall target="Recopie des images">
    <param name="paquetage" value="${paquetage1}"/>
  </antcall>
  <antcall target="Recopie des images">
    <param name="paquetage" value="${paquetage2}"/>
  </antcall>
  <antcall target="Recopie des images">
    <param name="paquetage" value="${paquetage3}"/>
  </antcall>
  <antcall target="Recopie des images">
    <param name="paquetage" value="${paquetage4}"/>
  </antcall>
  <antcall target="Recopie des images">
    <param name="paquetage" value="${paquetage5}"/>
  </antcall>
</target>

Though you've factored all the common code out, you sure haven't saved
any typing! I've seen postings asking for a 'foreach' kind of task,
this is one of those cases where a task like that would really be
handy!

- Don



--- Cyriaque Dupoirieux <cyriaque.dupoirieux@pcotech.fr> wrote:
> Hello,
> 
>    I need to do several times the same thing for different
> directories.
> I want to factorise that kind of task :
> 
> <target name="Recopie des images">
>        <copy todir="${codes}/${paquetage1}/${images}" >
>            <fileset dir="${sources}/${paquetage1}/${images}"/>
>        </copy>
>        <copy todir="${codes}/${paquetage2}/${images}" >
>             <fileset dir="${sources}/${paquetage2}/${images}"/>
>        </copy>
>        <copy todir="${codes}/${paquetage3}/${images}" >
>             <fileset dir="${sources}/${paquetage3}/${images}"/>
>        </copy>
>        <copy todir="${codes}/${paquetage4}/${images}" >
>             <fileset dir="${sources}/${paquetage4}/${images}"/>
>        </copy>
>        <copy todir="${codes}/${paquetage5}/${images}" >
>             <fileset dir="${sources}/${paquetage5}/${images}"/>
>        </copy>
> </target>
> 
> into a task like the following :
> <target name="Recopie des images">
>         <copy todir="${codes}/${paquetage}/${images}" >
>             <fileset dir="${sources}/${paquetage}/${images}"/>
>         </copy>
> </target>
> 
> where I would change the value of ${paquetage} (package in french ;)
> )  
> each time
> I call for the target.
> 
> Is it possible ?
> 
> Thanks and regards,
> 
> -- 
> Cyriaque Dupoirieux
> PCO Technologies
> Burolines - 2 ter rue Marcel Doret
> 31700 Blagnac
> TÚl : 05 34 60 44 13 - Fax : 05 34 60 44 10
> 


=====
Don

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Mime
View raw message