ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Ivanov <rambiusparkisan...@yahoo.com>
Subject Re: While Looping in ANT
Date Sat, 23 Jul 2005 05:42:14 GMT
Hello Jacob,

I am not quite sure I understand what do you mean.

--- "Jacob, Anil - MWL"
<jacob.anil@menloworldwide.com> wrote:
> 
> Does anyone know how I implement a loop similar to a
> while loop?

Generally, ant-contrib[1] provides looping tasks like
<for> and <foreach>.
> 
>  I want to keep checking to see if a particular
> property is set in a
> target, once that target is executed it can be a
> while before the
> property is finally set,
What does "a while before" means? If you read the
value of the property from a kind of "asynchronous"
source, you may find useful <sleep>[2] task. Using
<sleep> you can pause your build process for
arbitrarily long time.

>then once the property is
> set I can execute
> another target.
> I would like to know how to keep checking for a
> property without exiting
> the ant JVM.

Well, after all you can always code a task, or a
script that implements a while loop until the property
is set (not tested, written only by memories):
    <scriptdef name="checkProp" language="javascript">
        <attribute name="property"/>
        <![CDATA[
            prop = attributes.get("property");
            while (project.getProperty(prop) == null)
{
//keep going
            }
//here the property must be set
        ]]>
    </scriptdef>

HTH Ivan

> Thx
> Anil
> 
[1]http://ant-contrib.sourceforge.net/
[2]http://ant.apache.org/manual/CoreTasks/sleep.html


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

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


Mime
View raw message