ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: global properties
Date Thu, 20 Sep 2001 17:00:37 GMT
Craig,

Could you explain what it is you're actually trying to do?  Are you trying
to run only one of either target1 or target2 (ie., if target1 was run,
don't run target2, and vice-versa)?

I'm not clear on why you're setting both use.target1 and use.target2 to
"true" and then if'ing on them in their respective targets -- how would
the if ever fail?

As for perpetuating a property set during an <antcall> (or <ant>), you can
use the <propertyfile> task in the called targets to write the properties
out to a property file, which then gets read in before the other target is
called (but again, I'm still not clear on what the various properties
you're setting are really for [eg., why prop1 and prop2 in both target1
and target2?]).

Diane

--- Craig Longman <craigl@begeek.com> wrote:
> On Thu, 2001-09-20 at 07:54, Conor MacNeill wrote:
> > Why not just do without the antcall's altogether - something like
> this, 
> > perhaps
> 
> i had considered doing almost exactly this, and aside from the desire to
> not use the depends in such a way, it was appearing that the antcall was
> just not going to be up to snuff.  my main concern was that you have no
> direct control over the ORDER of the depends.  in this example, the
> default2 assumes the responsibility of the 'init' target, and absolutely
> has to be run before the other targets.
> 
> so, i was doing it this way but it was not appearing to work.  so, i
> tried your suggestion, although i couldn't see any difference.  and
> guess what?  the <fail.../> is never called!  it almost seems like the
> decision to run or not run a target is made before any one of the
> depends is executed.
> 
> any idea why this doesn't do the right thing?
> 
> aside from my real problem with how to make a target called by antcall
> set a property that other targets will be able to see.
> 
> > <project name="test" default="default2">
> > 
> > <target name="default1">
> >          <property name="use.target1" value="true"/>
> >          <property name="use.target2" value="true"/>
> > </target>
> > 
> > <target name="default2" depends="default1, target1, target2">
> >          <echo message="${prop2}"/>
> > </target>
> > 
> > <target name="target1" depends="check" if="use.target1">
> >          <property name="prop1" value="test1a"/>
> >          <property name="prop2" value="test2a"/>
> > </target>
> > 
> > <target name="target2" depends="check" if="use.target2">
> >          <property name="prop1" value="test1b"/>
> >          <property name="prop2" value="test2b"/>
> > </target>
> > 
> > <target name="check" if="prop1">
> >          <fail message="prop1 already set"/>
> > </target>
> > 
> > </project>
> 
> 
> cheers,
> 
>      CraigL->Thx();
> 
> 


=====
(holtdl@yahoo.com)



__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

Mime
View raw message