You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Ingmar Stein <st...@xtramind.com> on 2001/12/18 15:27:26 UTC
Logic crossed with fail's if attribute
Hi all,
the following target
<target name="check" description="Checks if property file is present">
<available file="xnbs.properties" property="available.properties"/>
<echo message="available.properties=${available.properties}"/>
<fail message="**** Error: the file xnbs.properties is not present ****"
unless="xnbs.properties"/>
</target>
gives this output:
check:
[echo] available.properties=true
BUILD FAILED
/home/tester/build.xml:21: **** Error: the file xnbs.properties is not
present ****
As you can see, the file is present, but the build fails.
It doesn't fail if I replace the "unless" with an "if".
Shouldn't that be the other way around?
I guess one logic is reversed, either mine or it's the following snippet of
Exit.java:
private boolean testIfCondition() {
if (ifCondition == null || "".equals(ifCondition)) {
return true;
}
return project.getProperty(ifCondition) != null;
}
private boolean testUnlessCondition() {
if (unlessCondition == null || "".equals(unlessCondition)) {
return true;
}
return project.getProperty(unlessCondition) == null;
}
Cheers,
Ingmar
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Logic crossed with fail's if attribute
Posted by Ingmar Stein <st...@xtramind.com>.
Oh man, please ignore that post...
I forgot to rename that occurence of xnbs.properties as well...
Sorry for that.
----- Original Message -----
From: "Alexander Syedin" <ac...@sunbay.com>
To: "Ant Developers List" <an...@jakarta.apache.org>
Sent: Tuesday, December 18, 2001 5:20 PM
Subject: Re: Logic crossed with fail's if attribute
> Ingmar,
> probably your snippet have to look like:
>
> <fail message="**** Error: the file xnbs.properties is not present ****"
unless="available.properties"/>
>
> --
> SY. Alexander Syedin
>
> On 18 Dec 2001 at 03:27:26, Ingmar Stein wrote:
> > Hi all,
> >
> > the following target
> >
> > <target name="check" description="Checks if property file is present">
> > <available file="xnbs.properties" property="available.properties"/>
> > <echo message="available.properties=${available.properties}"/>
> > <fail message="**** Error: the file xnbs.properties is not present
****"
> > unless="xnbs.properties"/>
> > </target>
> >
> > gives this output:
> >
> > check:
> > [echo] available.properties=true
> >
> > BUILD FAILED
> > /home/tester/build.xml:21: **** Error: the file xnbs.properties is not
> > present ****
> >
> > As you can see, the file is present, but the build fails.
> > It doesn't fail if I replace the "unless" with an "if".
> > Shouldn't that be the other way around?
> >
> > I guess one logic is reversed, either mine or it's the following snippet
of
> > Exit.java:
> >
> > private boolean testIfCondition() {
> > if (ifCondition == null || "".equals(ifCondition)) {
> > return true;
> > }
> >
> > return project.getProperty(ifCondition) != null;
> > }
> >
> > private boolean testUnlessCondition() {
> > if (unlessCondition == null || "".equals(unlessCondition)) {
> > return true;
> > }
> > return project.getProperty(unlessCondition) == null;
> > }
> >
> > Cheers,
> >
> > Ingmar
> >
> >
> > --
> > 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>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Logic crossed with fail's if attribute
Posted by Alexander Syedin <ac...@sunbay.com>.
Ingmar,
probably your snippet have to look like:
<fail message="**** Error: the file xnbs.properties is not present ****" unless="available.properties"/>
--
SY. Alexander Syedin
On 18 Dec 2001 at 03:27:26, Ingmar Stein wrote:
> Hi all,
>
> the following target
>
> <target name="check" description="Checks if property file is present">
> <available file="xnbs.properties" property="available.properties"/>
> <echo message="available.properties=${available.properties}"/>
> <fail message="**** Error: the file xnbs.properties is not present ****"
> unless="xnbs.properties"/>
> </target>
>
> gives this output:
>
> check:
> [echo] available.properties=true
>
> BUILD FAILED
> /home/tester/build.xml:21: **** Error: the file xnbs.properties is not
> present ****
>
> As you can see, the file is present, but the build fails.
> It doesn't fail if I replace the "unless" with an "if".
> Shouldn't that be the other way around?
>
> I guess one logic is reversed, either mine or it's the following snippet of
> Exit.java:
>
> private boolean testIfCondition() {
> if (ifCondition == null || "".equals(ifCondition)) {
> return true;
> }
>
> return project.getProperty(ifCondition) != null;
> }
>
> private boolean testUnlessCondition() {
> if (unlessCondition == null || "".equals(unlessCondition)) {
> return true;
> }
> return project.getProperty(unlessCondition) == null;
> }
>
> Cheers,
>
> Ingmar
>
>
> --
> 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>