(OT: this should be put in ant-users, but since it was posted to ant-dev...)

Oh, it's not that difficult.  Just make some "global" ant code:

        <target name="unless-failure" unless="${failure.property}">
                <antcall target="on-failure" />
                <fail message="Property ${failure.property} does not exist:
${failure.message}" />
        </target>
        <target name="if-failure" if="${failure.property}">
                <antcall target="on-failure" />
                <fail message="Property ${failure.property} exists:
${failure.message}" />
        </target>
        <target name="failure">
                <antcall target="on-failure" />
                <fail message="${failure.message}" />
        </target>
        <target name="on-failure">
                <!-- insert failure cleanup code -->
        </target>

Then, instead of directly using a <fail> task, use something like:
        <antcall target="unless-fail">
                <param name="failure.property"
value="required-property-name" />
                <param name="failure.message" value="You must provide this
property in order to run the build!" />
        </antcall>

Yet, if this is nearly universal functionality, it begs the question:
shouldn't it be easier and more standardized?

Or perhaps the external linking needs to be encouraged to develop Ant
libraries written in Ant!


-Matt Albrecht 

> -----Original Message-----
> From: Tim Dawson [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 01, 2001 4:00 PM
> To: 'Ant Developers List'
> Subject: RE: fail task
> 
> 
> heh, get in line.
> 
> this has been asked for repeatedly by lots of different people (myself
> included), but the people-in-charge here seem to dislike this feature
> because of the "slippery slope" of having if/unless requested 
> for every
> task.
> 
> nevermind of course that <fail> is almost worthless as-is 
> because of how
> hard it is to use.
> 
> but I'm not bitter or anything. :-)
> 
> Tim
> 
> > -----Original Message-----
> > From: Fabricio Matheus Goncalves 
> > [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, October 31, 2001 4:43 PM
> > To: ant-dev
> > Subject: fail task
> > 
> > 
> > 
> > Hi again,
> > 
> >     feature request: how about a condition <fail> task, 
> > with if and/or
> > unless attributes.
> > 
> >     how may I have access to cvs tree? I thinks i could do this.
> > 
> > thanks.
> > 
> > 
> > 
> > 
> > 
> > --
> > To unsubscribe, e-mail:   
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: 
> > <mailto:[EMAIL PROTECTED]>
> > 
> 
> --
> To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to