ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peter.rei...@corvil.com>
Subject Re: if/unless/depends on macrodefs
Date Fri, 05 Mar 2004 14:29:16 GMT
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


Mime
View raw message