ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpfoe...@ThoughtWorks.com
Subject Re: [RFE] Richer Task Specification
Date Thu, 22 Jun 2000 17:58:50 GMT

another option is to nest any neccesary tasks inside the taskdef:

<project default="codegen" basedir=".">

    <taskdef name="xslt" classname="Xslt" classpath="lib">
        <javac srcdir="lib" destdir="lib" />
    </taskdef>

    <target name="codegen" depends="">
        <xslt infile="${Courier.xml}"
            xsltfile="${fontfile.xsl}"
            outfile="${build.src}/fonts/Courier.java"
            smart="yes" />
    </target>

But I think I prefer the following, since it allows multiple tasks to
depend on a single compile:

<project default="codegen" basedir=".">

    <taskdef name="xslt" classname="Xslt" classpath="lib" depends
="xslt-compile"/>

    <target name="xslt-compile">
        <javac srcdir="lib" destdir="lib" />
    </taskdef>

    <target name="codegen" depends="">
        <xslt infile="${Courier.xml}"
            xsltfile="${fontfile.xsl}"
            outfile="${build.src}/fonts/Courier.java"
            smart="yes" />
    </target>

Matt Foemmel
ThoughtWorks, Inc.


                                                                                         
                                                         
                    James Duncan                                                         
                                                         
                    Davidson                  To:     <ant-dev@jakarta.apache.org> 
                                                               
                    <james.davidson@en        cc:                                     
                                                            
                    g.sun.com>                Subject:     Re: [RFE] Richer Task Specification
                                                    
                                                                                         
                                                         
                    06/22/00 12:43 PM                                                    
                                                         
                    Please respond to                                                    
                                                         
                    ant-dev                                                              
                                                         
                                                                                         
                                                         
                                                                                         
                                                         




on 2000/06/21 16:38, rubys@us.ibm.com at rubys@us.ibm.com wrote:


> Note: I am no longer in favor of this approach.  I prefer Stefan's:
>
> <project default="codegen" basedir=".">
>
> <target name="codegen" depends="">
>
> <javac srcdir="lib" destdir="lib" />
> <taskdef name="xslt" classname="Xslt" />
>
> <xslt infile="${Courier.xml}"
> xsltfile="${fontfile.xsl}"
> outfile="${build.src}/fonts/Courier.java"
> smart="yes" />
>
> </target>
>
> </project>

I think I like this more than I like the static inclusion of tasks. Mainly
as this is ordered and the inclusion of tasks to taskdefs isn't really.

I assume that this taskdef is local to the task since it's a child of task?

It might be useful to add a classpath attribute to taskdef to specify a
relative path to the place to pick the class up from. (create a classloader
and use it)

I am still a bit concerned that taskdefs are allowable at both the project
level and the task level, but don't have a better idea at the moment, so
I'm
ok with this.

.duncan





Mime
View raw message