ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Corbin <dcor...@users.sourceforge.net>
Subject Re: if/unless/depends on macrodefs
Date Sat, 06 Mar 2004 11:42:30 GMT
On Friday 05 March 2004 09:29, Peter Reilly wrote:

Yes, I think that would work, but I think it would be better if the sequential 
tag took the unless/depends.  Then it would not be necessary to introduce a 
third macrodef, and the macrodefs (which are task-like) can then handle 
depenencies internally more naturally as native tasks do.

> I have been thinking of adding this.
>
> I assume that you want to do something like this,
> using your current macrodef, check-ejb and ejb macrodefs,
>
> <macrodef name="check-and-do-ejb">
>    <attribute name="module">
>    <sequential>
>       <check-ejb module="@{module}"/>
>       <ejb module="@{module}" unless="@{module}-uptodate"/>
>    </sequential>
> </macrodef>
>
> In the mean-time, you could use the <if> task from ant-contrib,
> place the ant-contrib.jar file in $ANT_HOME/libs, or in ~/.ant/libs
> and do:
> <project ... xmlns:ac="antlib:net.sf.antcontrib">
> ..
> .
> .
>  <macrodef name="check-and-do-ejb">
>    <attribute name="module">
>    <sequential>
>       <check-ejb module="${module}"/>
>       <ac:if>
>           <ac:isset property="@{module}-uptodate"/>
>           <ac:else>
>              <ejb module="@{module}"/>
>           </ac:else>
>       </ac:if>
>    </sequential>
> </macrodef>
>
> Peter
>
> David Corbin wrote:
> >It would be really neat if I could use the if/unless on macrodefs.
> >
> >I've create a macro for code generation, and I call it 8 times to do
> > stuff. Macros make for nice clean "code".  But now that I'm trying to
> > incorporate uptodate support, I'm having to introduce a lot of repetative
> > targes with the same patterns:
> >
> ><target name="check-ejb-foo">
> >   <check-ejb module="foo" />
> ><target>
> ><target name="ejb-foo" unless="check-ejb-foo" unless="foo-uptotdate">
> >   <ejb module="foo" />
> ></target>
> >
> ><target name="allejb" depends="ejb-foo,...." />
> >
> >instead of
> ><target name="allejb">
> >  <ejb module="foo">
> >  .
> >  .
> >  .
> ></target>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org

-- 
David Corbin <dcorbin@users.sourceforge.net>


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


Mime
View raw message