ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rhino" <rhi...@sympatico.ca>
Subject Re: Need guidance re <fail>
Date Mon, 25 Oct 2004 13:29:29 GMT
Erik,

Putting the <sound> task at the beginning of the build outside of any target
solved my problem. *That* was the effect I was after. Until I made that
change, I was not able to get the failure sound to play no matter what error
occurred.

If the manual article on <sound> had simply said that, I could have saved
myself a lot of time fiddling around with different experiments....

Thanks VERY much for your help with this!

Rhino

----- Original Message ----- 
From: "Erik Hatcher" <erik@ehatchersolutions.com>
To: "Ant Users List" <user@ant.apache.org>
Sent: Monday, October 25, 2004 4:55 AM
Subject: Re: Need guidance re <fail>


>
> On Oct 24, 2004, at 3:37 PM, Rhino wrote:
> > <target name="end" depends="init,echo" description="Tasks that should
> > always
> > be run upon completion of the build.">
> >
> > <echo message="The resume has been successfully uploaded to the
> > ${servername} server."/>
> >
> > <sound description="Play success or failure sounds, whichever is
> > appropriate">
> >
> > <success source="${sound.success}"/>
> >
> > <fail source="${sound.failure}"/>
> >
> > </sound>
> >
> > </target>
> >
> > </project>
> >
> > Remarks:
> > There are only a few things that can go wrong in this simple example.
> > For
> > instance, I can fail to provide any input for the two <input> tasks in
> > the
> > 'getlogin' target (by pressing the Cancel button). I suppose there
> > would
> > also be errors if the specified property file doesn't exist when I do
> > the
> > 'echo' target.
> >
> > Question:
> > My idea of how <fail> and <sound> work together *was* as follows: if
> > all of
> > the build steps work, when we get to the 'end' target, the success
> > sound
> > would be played. If *any* of the build steps failed, the build would
> > branch
> > to the 'end' target and play the failure sound.
>
> Ant does not have this type of branching to a target when the build
> fails.  When a task fails, the build stops right there.  The only
> custom hook you have for doing something when the build fails is to use
> your own BuildLogger or BuildListener.
>
> The <sound> task should be used at the top of the build file, either
> outside of any targets, or within an "init" target that always is run.
> <sound> registers a hook that triggers when the build finishes, so you
> need to have it run at the start to ensure the trigger is set.
>
> > Can someone tell me what changes I would need to make to get the
> > behaviour I
> > want? (Assuming it is *possible* to get the behaviour I want! If it
> > isn't
> > possible, what CAN behaviour can I get that would be reasonably
> > similar and
> > how would I get it?)
>
> So again, its not possible the way you currently think.  But using a
> custom BuildListener/Logger you can write Java code to do what you
> want.
>
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>


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


Mime
View raw message