ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran" <>
Subject Re: condition shortcutting
Date Tue, 15 Jan 2002 01:25:13 GMT

----- Original Message -----
From: "Magesh Umasankar" <>
To: "Ant Developers List" <>
Sent: Monday, January 14, 2002 16:59
Subject: Re: condition shortcutting

> From: "Steve Loughran" <>
> >
> > I have a change to <condition> which doesnt run any of the tests if the
> > property is already set; shortcutting the entire test.
> >
> Is your change something along the lines of an extra
> element to condition like <propertyset name="foo"/>
> which would evaluate to true if foo is set or
> <propertyset name="foo" value="bar"/> which will
> evaluate to true if foo is set to the value bar?

no, it is like we dont bother evaluating any conditions if the dest property
is already set, because the immutability rules imply that the condition
cannot change the value of the property anyway.

So it's about 2 lines of code in, which is why I didnt bother
mentioning it. I will post it later, when I have it to hand, but roughly it
goes into execute as

if(project.getProperty(property)!=null) {
    //eval the condition

No changes to the external interface, no changes to the behavior of the
build, except that conditions dont get evaled if the test is overridden.

This can make a build faster and let you do things like

<condition "box.offline">
 <http url=">

if the box.offline property is set to true already, then the test isnt
attempted. To get the same effect you would have to do today

<condition "box.offline">
  <isset property="box.offline"/>
  <http url=">

If the result of any condition is not set (the default), this has no effect
whatsoever. It is only a speedup/bypass if somebody overrides a test

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message