Nope! Because each <antcall> defines a new Project, and properties set in
that 'child' project (created by <antcall>) are not visible to the parent
project. That's the way <antcall> works. Properties percolate down (unless
inheritAll='false'; or is that just an <ant> attribute?), but never up.

So <antcall target="first"/> doesn't really set the "first_built" property,
it sets the "antcall#1:first_built" property, which is not visible to
<antcall target="second"/> (which sets "antcall#2:first_built" when it runs
the 'first' target). Neither this properties would be visible if you tried
to <echo> them in your main target after the 2 antcalls...

Hope this help clarify things a bit. --DD

-----Original Message-----
From: David Adams [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, August 01, 2002 5:14 PM
To: [EMAIL PROTECTED]
Subject: Target/unless not working

I am attempting to manage build dependencies by setting a property in a
target and then filtering on that property using "unless", which should
avoid running that target since the property was set. 

Below is an example of the code I am trying:
<project name="masterbuild" default="main" basedir=".">
        <target name="init">
                <echo message="init"/>
        </target>

        <target name="first" depends="init" unless="first_built">
                <echo message="first"/>
                <property name="first_built" value="true"/>
                <echo message="${first_built}"/>

        </target>

        <target name="second" unless="second_built" depends="first">
                <echo message="${first_built}"/>
                <property name="second_built" value="true"/>

        </target>
        
        <target name="main">
                <antcall target="first"/>
                <antcall target="second"/>
        </target>
    
</project>

My output is:
main:

init:
     [echo] init

first:
     [echo] first
     [echo] true

init:
     [echo] init

first:
     [echo] first
     [echo] true

second:
     [echo] true

BUILD SUCCESSFUL
Total time: 9 seconds

The expectation is that "second" runs without going into "first".

Thoughts?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
David Adams
Ignite Sports (www.ignitesports.com)
Voice: 773.293.4300
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



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

Reply via email to