ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: Conditionally passing property to <ant>
Date Tue, 29 Apr 2003 16:50:25 GMT
Some thoughts ...

- prefixes this properties e.g.   forSubs.mydir
- echo these properties out using <echoproperties> into a file
  filtered by the prefix
- let the "sub" ant load that property file


another thought

- extend echo with "if" attribute
- use that echo for creating the property file
- let the "sub" ant load that property file

or

- extend the param class ...


Jan Matèrne


> -----Urspr√ľngliche Nachricht-----
> Von: Christopher Lenz [mailto:cmlenz@gmx.de]
> Gesendet am: Dienstag, 29. April 2003 16:52
> An: Ant Users List
> Betreff: Re: Conditionally passing property to <ant>
> 
> Jesse Stockall wrote:
> > On Tue, 2003-04-29 at 06:57, Christopher Lenz wrote:
> > 
> >>Hi folks,
> >>
> >>I'd like to call another build file with a set of optional 
> properties. 
> >>If defined, those properties point to directories. In 
> addition, I cannot 
> >>use property inheritance.
> >>
> >>The naive attempt
> >>
> >>   <ant dir="${the.dir}" inheritAll="false">
> >>     <property name="mydir" value="${mydir}"/>
> >>   </ant>
> >>
> >>works fine if 'mydir' has been defined, but of course fails when it 
> >>hasn't -- because the property is set to the literal ${mydir}. The 
> >>called script checks whether the property has been set, and only 
> >>executes some tasks if it has.
> >>
> >>So what I'd need would basically be:
> >>
> >>   <ant dir="${the.dir}" inheritAll="false">
> >>     <property name="mydir" value="${mydir}" if="mydir"/>
> >>   </ant>
> >>
> >>Any ideas?
> >>
> > 
> > 
> > In your main build file have 3 targets
> > 
> > <target name="callantwithdir" if="mydir">
> >   <ant dir="${the.dir}" inheritAll="false">
> >     <property name="mydir" value="${mydir}"/>
> >   </ant>
> > </target>
> > 
> > and
> > 
> > <target name="callantnodir" unless="mydir">
> >   <ant dir="${the.dir}" inheritAll="false"/>
> > </target>
> > 
> > and
> > 
> > <target name="callant" depends="callantwithdir, callantnodir"/>
> > 
> > Use the 'callant' target and it will execute other build 
> file with the
> > desired properties. 
> > 
> 
> Yeah, I thought of that. The problem's that I have 7 or so of those 
> properties that I want to pass at once, so that would lots of 
> targets :-P
> 
> -chris
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message