You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Herman, Dave" <dh...@intrado.com> on 2002/01/16 19:21:18 UTC

if/unless?

Hello,

Would it be useful to add optional "if" and "unless" parameters to the
<fail> task, so that you don't have to go through the rather ugly process of
making a separate little target?

For example, you can currently find yourself in a situation like this
(unless there's a more elegant method I haven't thought of):

    <!-- run junit, generate reports, then fail if errors occurred -->
    <target name="junit">
        <junit failureProperty="junit.failed" ... />
        <junitreport ... />
        <antcall target="check-junit-failures"/>
    </target>

    <target name="check-junit-failures" if="junit.failed">
        <fail message="JUnit failed."/>
    </target>

But it might be nicer to be able to do:

    <!-- run junit, generate reports, then fail if errors occurred -->
    <target name="junit">
        <junit failureProperty="junit.failed" ... />
        <junitreport ... />
        <fail message="JUnit failed." if="junit.failed"/>
    </target>

Or does this get into the ugly arguments about conditionals?

Thanks,
Dave H

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: if/unless?

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
That feature is available in the CVS version of Ant.  Grab a nightly build
or build it yourself from CVS... or wait for Ant 1.5 to be released!  :)


----- Original Message -----
From: "Herman, Dave" <dh...@intrado.com>
To: "Ant Users List (E-mail)" <an...@jakarta.apache.org>
Sent: Wednesday, January 16, 2002 1:21 PM
Subject: <fail> if/unless?


> Hello,
>
> Would it be useful to add optional "if" and "unless" parameters to the
> <fail> task, so that you don't have to go through the rather ugly process
of
> making a separate little target?
>
> For example, you can currently find yourself in a situation like this
> (unless there's a more elegant method I haven't thought of):
>
>     <!-- run junit, generate reports, then fail if errors occurred -->
>     <target name="junit">
>         <junit failureProperty="junit.failed" ... />
>         <junitreport ... />
>         <antcall target="check-junit-failures"/>
>     </target>
>
>     <target name="check-junit-failures" if="junit.failed">
>         <fail message="JUnit failed."/>
>     </target>
>
> But it might be nicer to be able to do:
>
>     <!-- run junit, generate reports, then fail if errors occurred -->
>     <target name="junit">
>         <junit failureProperty="junit.failed" ... />
>         <junitreport ... />
>         <fail message="JUnit failed." if="junit.failed"/>
>     </target>
>
> Or does this get into the ugly arguments about conditionals?
>
> Thanks,
> Dave H
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>