You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Felipe Leme <t5...@sneakemail.com> on 2003/08/16 05:01:56 UTC

Running ant in loop mode

Hello all,

I submitted a patch recently on Ant's bugzilla, and I'd like to discuss it 
here in the list.

The initial idea would be to add a command line parameter (-loop) to ant, so 
it can run in loop mode. 

In this mode, once the tasks are finished, ant will wait for the user to press 
Enter to run the tasks again or q to quit (similar to incremental compilation 
on Jikes).

That would be pretty useful in situations where a task must be performed many 
times in a short period of time - like redeploying modified JSP pages to a 
web container: usually these task itself is almost instantaneous, but it 
takes about 5-6 seconds using the regular ant due to the overhead caused by 
the JVM invocation.

With this patch, the new tasks are executed really fast, as shown below:

ant -loop copy_web_oc4j
Buildfile: build.xml

copy_web_oc4j:
     [copy] Copying 1 file to /home/felipeal/eInquiry/build/deploy/oc4j/CSNAPP

BUILD SUCCESSFUL
Total time: 2 seconds // first evocation, took 2 seconds

Press Enter to continue or q + Enter to quit


copy_web_oc4j:
     [copy] Copying 1 file to /home/felipeal/eInquiry/build/deploy/oc4j/CSNAPP

BUILD SUCCESSFUL
Total time: 0 seconds // sub-sequent iterations: 0 seconds

Press Enter to continue or q + Enter to quit


I submitted a first patch yesterday (even though we'been been using it 
internally in my company for a couple of days) and talked with Antoine in 
private, and he pointed a valid issue: the patch was too simplistic. For 
instance, how would an IDE handle the System.in calls?

So, even though most IDEs call ant in a particular way, I improved the patch a 
little bit: now the Main class has 2 new attributes, loopMode and 
loopHandler, which could be set by the IDEs. LoopHandler is a new interface, 
whose default implementation uses System.in.read().


So, what do you guys think of the patch? I think it would be really useful, 
and easy to implement (of course, if I didn't think so I wouldn't suggest it 
:-). If it is accepted, I could offer more help documenting and testing it 
(personally and with the participation of folks at my company and JUG).

Regards,

Felipe



PS: here is the enhancement's URL:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22428

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


Re: Running ant in loop mode

Posted by Felipe Leme <t5...@sneakemail.com>.
On Saturday 16 August 2003 07:22 am, Nicola Ken Barozzi wrote: 

> I'm not an Ant committer, but a heavy Ant user, and I can say that I

I'm in the same situation...

> It's months that I wanted this but really never got round doing it, and

Actually, I've been thinking about the patch for months too, but only recently 
got the balls to work on it...

> I'm happy that someone else has done it.

I'm happy that I finally did it too :-)

> I would add a couple of suggestions if you don't mind, as I would
> basically keep -loop as now but would be thrilled to se other features
> very similar to it:
>
> 1 - it would really be nifty if there was also an -interactive mode,
>      where a special LoopHandler is able to read also a new target
>      invocation

This option would be nice too, although the implementation would be more 
complex (as it  would require parsing the user input and creating a new array 
of arguments in every iteration).

For now, let's see what the developers/committers think about them (as I said 
before, I could help implementing/testing the patch if its accepted).

[]s,

Felipe





 

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


Re: Running ant in loop mode

Posted by Nicola Ken Barozzi <ni...@apache.org>.
Felipe Leme wrote, On 16/08/2003 5.01:
> Hello all,
...
> The initial idea would be to add a command line parameter (-loop) to ant, so 
> it can run in loop mode. 
...
> With this patch, the new tasks are executed really fast
...
> I improved the patch a 
> little bit: now the Main class has 2 new attributes, loopMode and 
> loopHandler, which could be set by the IDEs. LoopHandler is a new interface, 
> whose default implementation uses System.in.read().
...
> So, what do you guys think of the patch? I think it would be really useful, 
> and easy to implement (of course, if I didn't think so I wouldn't suggest it 
> :-). If it is accepted, I could offer more help documenting and testing it 
> (personally and with the participation of folks at my company and JUG).

I'm not an Ant committer, but a heavy Ant user, and I can say that I 
really like it :-)

It's months that I wanted this but really never got round doing it, and 
I'm happy that someone else has done it.

I would add a couple of suggestions if you don't mind, as I would 
basically keep -loop as now but would be thrilled to se other features 
very similar to it:

1 - it would really be nifty if there was also an -interactive mode,
     where a special LoopHandler is able to read also a new target
     invocation

2 - also having a LoopHandler to accept the tasks to run via
     socket (it can be easily implemented when 1 is done)


So when 1 is done, it would be:

ant -loop targetname
Buildfile: build.xml

targetname:
      [...] ...

BUILD SUCCESSFUL
Total time: 2 seconds // first evocation, took 2 seconds

Press Enter to continue
       q + Enter to quit
       targetnames + Enter to change invocation
 >target3 target4 (Enter)

Buildfile: build.xml

target3 :
      [...] ...
target4 :
      [...] ...

BUILD SUCCESSFUL
Total time: 3 seconds // first evocation, took 3 seconds

Press Enter to continue
       q + Enter to quit
       targetnames + Enter to change invocation
 >(Enter)

Buildfile: build.xml

target3 :
      [...] ...
target4 :
      [...] ...

BUILD SUCCESSFUL
Total time: 1 seconds // first evocation, took 3 seconds

Press Enter to continue
       q + Enter to quit
       targetnames + Enter to change invocation
 >q(Enter)

$>_

> PS: here is the enhancement's URL:
> 
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22428

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------



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