ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <j_a_fernan...@yahoo.com>
Subject RE: if and unless attributes for all Tasks
Date Wed, 16 May 2001 01:37:38 GMT
> From: ageo@mail.hereuare.com
>
> This is less useful than it might appear, because anything in
> a 'depends'
> is only run once per execution regardless of the
> conditional's value.  So
> using your example, if you are running multiple targets that
> require the
> conditional processing of say t1, t1 will run 1 or 0 times
> regardless of
> the value of c1.
>
> All I am saying is that your two examples are not
> functionally the same.
> With task level if's I can conditionally execute task/target
> multiple times
> in one run, with depends alone, I can't.
>

       <target name="A" depends="B,C">
        <antcall target="t1" />
        <antcall target="t2" />
       </target>

       <target name="t1 if="c1" > <task1> </target>
       <target name="t2" if="c2" > <task2> </target>

This I solves most of the issues, except for the ability to call "t1" from
the command line, but that to me is a minor issue.

Jose Alberto

> -alan
>
> Jose Alberto Fernandez wrote:
>
> > Just to cut to the chase, what Peter is trying to say is
> that instead of
> > asking for:
> >
> >         <target name="A" depends="B,C">
> >         <task1 if="c1" />
> >         <task2 if="c2" />
> >         </target>
> >
> > the way to do this in ANT is:
> >
> >         <target name="A" depends="B,C,t1,t2" />
> >
> >         <target name="t1 if="c1" > <task1> </target>
> >         <target name="t2" if="c2" > <task2> </target>
> >
> > That's it.
> >
> > > -----Original Message-----
> > > From: Daniel Barclay [mailto:Daniel.Barclay@digitalfocus.com]
> > > Sent: Tuesday, May 15, 2001 4:23 PM
> > > To: ant-dev@jakarta.apache.org
> > > Subject: Re: if and unless attributes for all Tasks
> > >
> > >
> > > Peter Donald wrote:
> > > >
> > > > At 01:04  14/5/01 -0400, Daniel Barclay wrote:
> > > > >> If you need it, wrap it in a target.
> > > > >
> > > > >That won't work well if you want different tasks
> within one target
> > > > >to have different conditions.
> > > >
> > > > If you have that then you misunderstand the notion of targets ;)
> > >
> > > I don't think so, but what you do mean?
> > >
> > > You don't think one might want to configure how a target
> is executed
> > > by parameterizing tasks with boolean values similarly to how we
> > > parameterize tasks with string values?
> > >
> > > Daniel
> > > --
> > > Daniel Barclay
> > > Digital Focus
> > > Daniel.Barclay@digitalfocus.com
> > >
>


Mime
View raw message