ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoine Levy-Lambert" <levylamb...@tiscali-dsl.de>
Subject Re: creating tasks
Date Thu, 20 Feb 2003 06:26:21 GMT
antcall does already the job, rather than taskdef. see this link :
http://ant.apache.org/manual/CoreTasks/antcall.html
----- Original Message -----
From: <Jan.Materne@rzf.fin-nrw.de>
To: <user@ant.apache.org>
Sent: Thursday, February 20, 2003 7:11 AM
Subject: AW: creating tasks


I can´t see any difference to the Ant-way:

<target name="compileCTask">
    <javac src="${ctask.src}" />
</target>

<target name="test" depends="compileTask">
    <taskdef name="test1" classname="..." classpath="${ctask.src}" />
    <test1 />
</target>


AFAIK Erik used such a construct in his book.


Jan Matèrne


> -----Ursprüngliche Nachricht-----
> Von: Ronald Klop [mailto:ronald-mailinglist@base.nl]
> Gesendet am: Mittwoch, 19. Februar 2003 17:42
> An: user@ant.apache.org
> Betreff: creating tasks
>
> Hello,
>
> I made the attached code today for creating tasks easily.
> The idea was using something like this:
>
> <taskdef name="custom" classname="nl.base.util.CustomTask">
> <classpath refid="local.classpath"/>
> </taskdef>
>
> <target name="test">
> <!-- define a new task named task1 -->
> <custom action="new" name="task1" args="dir">
> <echo>Compiling ${task1.dir}</echo>
> <javac srcdir="${task1.dir}"/>
> <delete .../>
> </custom>
> <!-- run the taks named task1 -->
> <custom action="do" name="task1" args="dir=/bla1"/>
> <custom action="do" name="task1" args="dir=/bla2"/>
> <custom action="do" name="task1" args="dir=/bla3"/>
> <custom action="do" name="task1" args="dir=/bla4"/>
> </target>
>
> The output would than be:
> [echo] Compiling /bla1
> [javac] ...
> [delete] ...
> [echo] Compiling /bla2
> [javac] ...
> [delete] ...
> [echo] Compiling /bla3
> [javac] ...
> [delete] ...
> [echo] Compiling /bla4
> [javac] ...
> [delete] ...
>
> So, my idea is to make a task which can execute a couple of
> other tasks,
> which can be defined in the build.xml.
>
> This works, but the problem is, that the arguments are evaluated at
> creation of the task and not at execution.
> So in the above example it wil print 'Compiling
> ${task1.dir}', because
> the property 'task1.dir' isn't known until execution.
>
> Is there a solution for this? Or are there other tasks which
> do the same
> as I want?
>
> Greetings,
>
> Ronald.
>



Mime
View raw message