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: How to conditionally run a group of targets?
Date Fri, 14 Dec 2007 06:30:12 GMT
Execution order of targets:
1. execute dependend targets
2. check if/unless
3. maybe (see #2) execute the target body 
This is required for a scenario where a dependend target does the checks for the targets.

But the simplest think is

<target name="A" depends="doit"/>
<target name="B" depends="doit"/>
<target name="C" depends="doit"/>
<target name="D" depends="doit"/>

for easier call you can add a additional

<target name="all" depends="A,B,C,D"/>



Jan



> -----Urspr√ľngliche Nachricht-----
> Von: Scot P. Floess [mailto:floess@mindspring.com] 
> Gesendet: Freitag, 14. Dezember 2007 03:47
> An: Ant Users List
> Betreff: Re: How to conditionally run a group of targets?
> 
> Why don't you try this...
> 
> <target name = "wrapper" if = "doit"  depends = "A, B, C, D"/>
> 
> The point is, the depends attribute acts as your grouping ;)
> 
> Cyril Sagan wrote:
> > Our build script needs to run an arbitrary *group* of 
> targets based on
> > a single property.  Can you help me find a clean way to do this?
> >
> > Here's an "almost solution" which illustrates what I'd like to
> > accomplish:
> >
> >     <target name="all" depends="init, decide_to_run_group, 
> wrapper" />
> >
> >     <target name="decide_to_run_group">
> >         <condition property="doit" value="true">
> >             <some-boolean-test/>
> >         </condition>
> >     </target>
> >
> >     <target name="wrapper" if="doit">
> >         <antcall>
> >             <target name="A" />
> >             <target name="B" />
> >             <target name="C" />
> >             <target name="D" />
> >         </antcall>
> >     </target>
> >
> >
> > This does not work.  The problem is that any properties set in the
> > <antcall>'d targets will not be visible in the calling environment.
> > Targets A,B,C,etc -- not all of which I control, so I cannot
> > restructure -- may have side effects, setting state in 
> properties that
> > I need to have access to.
> >
> > Regarding the "<antcall> almost solution", I see that there are ways
> > to pass properties "down to" <antcall>, but I do not know of a clean
> > way to "pass back".  I found a year+ old question on ant-dev asking
> > about this, but never saw an answer.
> >
> > In any case, we aren't set on using (enhancing?) <antcall>, it was
> > just close to a solution.
> >
> > Goal is to group the set of targets.  I'm hoping to find a solution
> > less awkward than this:
> >     <target name="A" if="doit" ... />
> >     <target name="B" if="doit" ... />
> >     <target name="C" if="doit" ... />
> >     <target name="D" if="doit" ... />
> >
> > Thanks for any suggestions.
> >
> > --Cyril
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
> >   
> 
> -- 
> Scot P. Floess
> 27 Lake Royale
> Louisburg, NC  27549
> 
> 252-478-8087 (Home)
> 919-754-4592 (Work)
> 
> Chief Architect JPlate   http://sourceforge.net/projects/jplate
> Chief Architect JavaPIM  http://sourceforge.net/projects/javapim
> QA Engineer OpenQabal    http://openqabal.dev.java.net
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message