You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David Corbin <dc...@users.sourceforge.net> on 2004/03/05 14:37:18 UTC
if/unless/depends on macrodefs
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>
--
David Corbin <dc...@users.sourceforge.net>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: if/unless/depends on macrodefs
Posted by David Corbin <dc...@users.sourceforge.net>.
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 <dc...@users.sourceforge.net>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: if/unless/depends on macrodefs
Posted by Peter Reilly <pe...@corvil.com>.
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