My other solution is to add the BuildListener to the main project. But I did not find yet how to get its instance when being run from a subproject.
On 7/28/05, Patrick Martin <[EMAIL PROTECTED]> wrote: > Hi, > > if I understand well, all BuildListeners set in the main project will > be transfered to each subproject. > My problem here is that I want to add a BuildListener inside the > subproject. As this BuildListener is not referenced in the main > project, it does not get notified when the build finishes. > > I just found that there is a SubBuildListener interface. But I guess > that implementing that will make the sub-project wait for thread > completion, not the main project. > > Patrick > > On 7/28/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Mmh - <antcall> maps [1] to org.apache.tools.ant.taskdefs.CallTarget [2]. > > The execute() method doesnt do any event delegating. So the init() could > > have something: > > 82 : public void init() { > > 83 : callee = new Ant(this); > > 84 : callee.init(); > > 85 : } > > > > The transfer of the BuildListeners is done in Ant.initializeProject() so we > > have to > > see where that is called... in Ant.execute(); > > And this is the last call of CallTarget.execute() ... mmh, the listeners > > should be > > attached ... > > > > > > Jan > > > > > > > > [1] > > http://cvs.apache.org/viewcvs.cgi/*checkout*/ant/src/main/org/apache/tools/ant/taskdefs/defaults.properties > > [2] > > http://cvs.apache.org/viewcvs.cgi/ant/src/main/org/apache/tools/ant/taskdefs/CallTarget.java?view=annotate > > > > >-----Ursprüngliche Nachricht----- > > >Von: Patrick Martin [mailto:[EMAIL PROTECTED] > > >Gesendet: Donnerstag, 28. Juli 2005 11:35 > > >An: Ant User > > >Betreff: No BuildFinished event in subproject > > > > > >Hello, > > > > > >I am writing a task that runs tasks in background and listens > > >to build events in order to make sure background threads > > >finish before the build ends (as suggested in [1]). > > > > > >The trick works perfectly well when running the task in the > > >main project, but I never get the BuildFinished event when I > > >run the task from a subproject (created with antcall). > > > > > >For example, the following script: > > > > > ><target name="test"> > > > <antcall target="test2" /> > > ></target> > > > > > ><target name="test2"> > > > <taskdef name="invoke" > > >classname="com.sardak.antform.util.TargetInvoker" /> > > > <invoke target="longTarget" background="true" /> </target> > > > > > ><target name="longTarget"> > > > <echo message="before wait" /> > > > <waitfor maxwait="5" maxwaitunit="second"> > > > <isset property="dummy.property" /> > > > </waitfor> > > > <echo message="after wait" /> > > ></target> > > > > > >Calling test2 works: the build waits until the completion of > > >longTarget. > > >Calling test fails: the build finishes before teh completion > > >of longTarget. > > > > > >Does it mean that subproject never fire a BuildFinished event? > > > > > >I am not including the task sources because it might be a bit > > >long, but I can do it if needed. > > > > > >Thank you, > > > > > >Patrick > > > > > >[1] http://marc.theaimsgroup.com/?l=ant-user&m=112242105429652&w=2 > > > > > >--------------------------------------------------------------------- > > >To unsubscribe, e-mail: [EMAIL PROTECTED] For > > >additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]