Thanks Diane!! :-)
--- Diane Holt <[EMAIL PROTECTED]> wrote:
> Actually, I'd take advantage of some of the new
> stuff available in 1.4
> (finally found some time to pick it up and start
> trying things out :) --
> namely, the new "inheritAll" attr for <antcall> and
> the new <condition>
> task, in conjunction with <propertyfile>'s
> incrementing functionality. For
> example:
>
> <property name="maxCount" value="10"/>
>
> <target name="doWhile">
> <propertyfile file="counter.properties">
> <entry key="counter" type="int"
> operation="+"/>
> </propertyfile>
> <property file="counter.properties"/>
> <condition property="loopDone">
> <equals arg1="${counter}" arg2="${maxCount}"/>
> </condition>
> <antcall target="doit"/>
> </target>
>
> <target name="doit" unless="loopDone">
> <echo message="Do stuff here..."/>
> <antcall target="doWhile" inheritAll="no"/>
> </target>
>
> will "Do stuff here" 9 times (it's not zero-based :)
> [Note: Make sure
> something removes counter.properties before the
> "doit" target gets run.]
>
> Diane
>
> --- Don Taylor <[EMAIL PROTECTED]> wrote:
> >
> > --- Edgar S�nchez <[EMAIL PROTECTED]> wrote:
> > > Thanks Don
> > >
> > > just a question.
> > > When you put the sample of the counter the
> "."
> > > after the counter means that the value will
> increment
> > > in one??
> >
> > Not the value, the property name. I'm creating a
> series of properties:
> >
> > counter
> > counter.
> > counter..
> > counter...
> >
> > The value is whatever.
> >
> > -- Don
> >
> > > <property name="${counter}." value="whatever"
> />
> > > or how do I increment in one the variable
> value of
> > > my counter?
> > >
> > > Thanks again
> > > VES
> > >
> > >
> > > --- Don Taylor <[EMAIL PROTECTED]>
> wrote:
> > > >
> > > > --- Edgar S�nchez <[EMAIL PROTECTED]> wrote:
> > > > > Hi everyone is Vincent again...
> > > > >
> > > > > now I've 2 questions, well those are for
> the
> > > > same
> > > > > reason..
> > > > > I was wondering if here in Ant could I
> make some
> > > > > jumps in order to repeat the same procedure
> with
> > > > other
> > > > > caracteristics,
> > > >
> > > > Yes, check out the antcall task. This allows
> you to
> > > > execute the
> > > > same target multiple times with different sets
> of
> > > > "inputs".
> > > >
> > > >
> > > > or if I can use loops like For or
> > > > > While to do the same, keeping a counter in
> order
> > > > to
> > > > > make conditions to execute the same
> procedure or
> > > > same
> > > > > target with diferent actions.
> > > > >
> > > > > Is it possible?
> > > >
> > > > When looping, you have to create a "kick-out"
> > > > condition. I used the
> > > > target's unless attribute. The idea is to loop
> until
> > > > the property is
> > > > set. However, because a target can't antcall
> itself,
> > > > you have to
> > > > replicate the target and have them cross-call
> each
> > > > other:
> > > >
> > > >
> > > > <target name="worker">
> > > > <!-- This does the actual work. May depend
> on
> > > > other workers. -->
> > > > </target>
> > > >
> > > > <target name="looper_1" depends="worker"
> > > > unless="some.condition">
> > > > <antcall target="looper_2"/>
> > > > </target>
> > > >
> > > > <target name="looper_2" depends="worker"
> > > > unless="some.condition">
> > > > <antcall target="looper_1"/>
> > > > </target>
> > > >
> > > >
> > > > This takes care of while loops. I've never
> tried
> > > > implementing a for
> > > > loop in Ant. I suppose you could do something
> like
> > > > the following
> > > > in the worker target:
> > > >
> > > > <property name="counter" value="counter" />
> > > >
> > > > <target name="worker">
> > > > <property name="${counter}."
> value="whatever" />
> > > > </target>
> > > >
> > > > Then if you wanted to loop 3 times:
> > > >
> > > > <target name="looper_1" depends="worker"
> > > > unless="counter...">
> > > > <antcall target="looper_2"/>
> > > > </target>
> > > >
> > > > <target name="looper_2" depends="worker"
> > > > unless="counter...">
> > > > <antcall target="looper_1"/>
> > > > </target>
> > > >
> > > > -- Don
> > > >
> > > >
> > > > >
> > > > > thank you
> > > > > VES
> > > > >
> > > > > =====
> > > > >
> > > > >
> > > >
> > >
>
_________________________________________________________________
> > > > >
> > > > > "Puedes sentirte desilusionado si fallas,
> pero
> > > > est�s condenado si no
> > > > > lo intentas."
> > > > >
> > > > > "You can get disappointed if you fail down,
> but
> > > > you are doomed if you
> > > > > do not try it."
> > > > >
> > > > > ICQ # 22338121
> > > > >
> > > > >
> > > > >
> __________________________________________________
> > > > > Do You Yahoo!?
> > > > > Make international calls for as low as
> $.04/minute
> > > > with Yahoo!
> > > > > Messenger
> > > > > http://phonecard.yahoo.com/
> > > >
> > > >
> > > >
> __________________________________________________
>
=== message truncated ===
=====
_________________________________________________________________
"Puedes sentirte desilusionado si fallas, pero est�s condenado si no lo intentas."
"You can get disappointed if you fail down, but you are doomed if you do not try it."
ICQ # 22338121
__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com