ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francis GALIEGUE <>
Subject Re: <target>s unless/if: strangeness in default behaviour (imho) (ant 1.6.5)
Date Tue, 01 Sep 2009 07:29:28 GMT
On Mon, Aug 31, 2009 at 17:17, David Weintraub<> wrote:
> Ant is not a programming language! Ant is not a programming language! Repeat
> that.
> Ant build system. And yes, there is a major difference. In a programming
> language, you set the exact order you want everything executed in. In a
> build system, the build system builds a dependency matrix and then decides
> on the order tp execute the various tasks in.
> When you execute Ant, the very first thing it does is look for all the
> targets in your build.xml file, and then builds a dependency matrix based
> upon each target's "depends" statement. It doesn't even look at the contents
> of the target or  the "if" and "unless" statements.
> Your issue is that you're treating the "if" and "unless" statements as if it
> was part of a programming language. Normally, the "if" and "unless"
> statements are used to prevent a target from executing because the
> conditions for that target aren't met, and this condition is normally set in
> a previous target. I do this type of stuff all the time:
> <target name="mytarget.test">
>     <condition property="">
>         <blah, blah, blah>
>     </condition>
> </target>
> <target name="mytarget" depends="mytarget.test"
>     if="">
>     <blah, blah, blah/>
> </target>
> In the above, I want to execute "mytarget" but I want to make sure
> everything is actually setup to execute this target. So, I have a
> "mytarget.test" target I depend upon. This sets a property letting me know
> if everything is all setup or not.
> I hope this explains why Ant is doing what it is doing and why your
> build.xml isn't quite doing what you expect.. It looks like (and what you
> did) was add the "nocoverage" if check to the other target. That's one way
> to handle this issue.

OK, this is a clear enough explanation. I'm not really sure about the
"programming language vs build system" analogy, though ;)

I think I still don't have "the ant way" of doing things even though
I've been using it for several years now...

Sorry for the waste of time,

Francis Galiegue
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
40 avenue Raymond Poincaré
75116 Paris

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

View raw message