You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Patrick Luebbecke <PA...@de.ibm.com> on 2008/09/24 11:30:22 UTC

Iterating through the build script

Hi Folks,

i'm currently writing a build script which will to the following tasks:


1. unpack file a
2. unpack file b (both files have the same directory and filestructure)

3. Replace several strings within different files

4. zip file a
5. zip file b

since file a and b have different filenames is there any way to make ant to

a) unpack file a
b) replace the strings
c) zip file a

d) unpack file b
e) replace the strings
f) zip file b

by invoking the "replace string"-target twice without changing my basic
code structure (1-5) ?

Regards


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


AW: Iterating through the build script

Posted by Ja...@rzf.fin-nrw.de.
Use <macrodef> to write a macro which does that job.

Jan

>-----Ursprüngliche Nachricht-----
>Von: Patrick Luebbecke [mailto:PATLUE@de.ibm.com] 
>Gesendet: Mittwoch, 24. September 2008 11:30
>An: user@ant.apache.org
>Betreff: Iterating through the build script
>
>
>Hi Folks,
>
>i'm currently writing a build script which will to the following tasks:
>
>
>1. unpack file a
>2. unpack file b (both files have the same directory and filestructure)
>
>3. Replace several strings within different files
>
>4. zip file a
>5. zip file b
>
>since file a and b have different filenames is there any way 
>to make ant to
>
>a) unpack file a
>b) replace the strings
>c) zip file a
>
>d) unpack file b
>e) replace the strings
>f) zip file b
>
>by invoking the "replace string"-target twice without changing my basic
>code structure (1-5) ?
>
>Regards
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>

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


AW: Iterating through the build script

Posted by Ja...@rzf.fin-nrw.de.
<antcall> works but has performance impacts because each call clones the Project-instance.
With introduction of <macrodef> in Ant 1.6 that would be faster.

Jan

>-----Ursprüngliche Nachricht-----
>Von: André Pilz [mailto:andre.pilz@pcvisit.de] 
>Gesendet: Mittwoch, 24. September 2008 11:54
>An: Ant Users List
>Betreff: Re: Iterating through the build script
>
>Hi,
>
>I use the <antcall> task for this, most often with parameters, example:
>
><target name="often-used-task">
>     <!-- check for parameters -->
>     <fail unless="prop" message="${prop} needed"/>
>     <!-- do it -->
>     ...
>     ...
>     ...
>     <echo message="done for ${prop}"/>
></target>
>
><antcall target="often-used-task">
>     <param name="prop" value="foo"/>
></antcall>
>
><antcall target="often-used-task">
>     <param name="prop" value="bar"/>
></antcall>
>
>Regards,
>AP
>
>Patrick Luebbecke schrieb:
>> Hi Folks,
>> 
>> i'm currently writing a build script which will to the 
>following tasks:
>> 
>> 
>> 1. unpack file a
>> 2. unpack file b (both files have the same directory and 
>filestructure)
>> 
>> 3. Replace several strings within different files
>> 
>> 4. zip file a
>> 5. zip file b
>> 
>> since file a and b have different filenames is there any way 
>to make ant to
>> 
>> a) unpack file a
>> b) replace the strings
>> c) zip file a
>> 
>> d) unpack file b
>> e) replace the strings
>> f) zip file b
>> 
>> by invoking the "replace string"-target twice without 
>changing my basic
>> code structure (1-5) ?
>> 
>> Regards
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>> 
>> 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>

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


Re: Iterating through the build script

Posted by André Pilz <an...@pcvisit.de>.
Hi,

I use the <antcall> task for this, most often with parameters, example:

<target name="often-used-task">
     <!-- check for parameters -->
     <fail unless="prop" message="${prop} needed"/>
     <!-- do it -->
     ...
     ...
     ...
     <echo message="done for ${prop}"/>
</target>

<antcall target="often-used-task">
     <param name="prop" value="foo"/>
</antcall>

<antcall target="often-used-task">
     <param name="prop" value="bar"/>
</antcall>

Regards,
AP

Patrick Luebbecke schrieb:
> Hi Folks,
> 
> i'm currently writing a build script which will to the following tasks:
> 
> 
> 1. unpack file a
> 2. unpack file b (both files have the same directory and filestructure)
> 
> 3. Replace several strings within different files
> 
> 4. zip file a
> 5. zip file b
> 
> since file a and b have different filenames is there any way to make ant to
> 
> a) unpack file a
> b) replace the strings
> c) zip file a
> 
> d) unpack file b
> e) replace the strings
> f) zip file b
> 
> by invoking the "replace string"-target twice without changing my basic
> code structure (1-5) ?
> 
> Regards
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 

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