ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <>
Subject RE: buildStarted/Finished and subbuilds
Date Wed, 23 Jun 2004 14:58:25 GMT
> From: Stefan Bodewig [] 
> Hi all,
> while investigating bug 8689 I realized that the Ant project 
> instances we create in Ant never fire the build started or 
> finished events.  I'm not entirely sure that this is a good 
> thing (but it probably is), but we probably can't change it 
> for backwards compatibility reasons anyway.
> This has a couple of consequences, one of them causes the 
> excess memory needed in AntClassLoader.  If a task in the 
> subbuild creates an AntClassLoader instance it never gets 
> cleaned up since the subproject never calls build finished.
> Another one is that any <record> task used in the subbuild 
> could leave open files hanging around until Ant exits.  For 
> what I propose below, I'll also have to add a close method to 
> RecorderEntry.
> Since I don't think we can "fix" the build* events for 
> subbuilds, I plan to do some things in <ant> after the 
> subbuild has finished:
> * remove all build listeners of the main project from the subbuild.
> * iterate over the remaining build listeners of the subbuild and
>   a) invoke cleanup() if it is an AntClassLoader
>   b) invoke close() if it is a RecorderEntry
> this is ugly, but any clean solution I could come up with is 
> not backwards compatible (add a dispose method to 
> BuildListener, make subbuilds fire buildFinished ...).
> Any better ideas?

How about defining a new interface "SubBuildListener" 
when ant iterates over the listeners if it finds one implementing this
interface it will call its finish() event or (some new method).

Here AntClassLoader and RecorderEntry will implement this new interface.

This looks like a more generic solution that other things can use
if so they desire.

Jose Alberto

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message