ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Target/unless not working
Date Thu, 01 Aug 2002 22:22:11 GMT
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:DAdams@ignitesports.com] 
Sent: Thursday, August 01, 2002 5:14 PM
To: ant-user@jakarta.apache.org
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:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message