ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpfoe...@ThoughtWorks.com
Subject Re: templates ...
Date Tue, 11 Jul 2000 18:17:42 GMT

i've been meaning to try using XSLT as a "macro" language for Ant, but
haven't gottten around to it yet. For example, you could use the following
stylesheet (or something simliar):

<xsl:template match="subproject">
     <mkdir dir="lib/{@name}"/>
     <javac srcdir="src/{@name}" destdir="lib/{@name}" classpath="..."/>
     <jar jarfile="{@name}.jar" basedir="lib/{@name}"/>
     <deltree dir="lib/{@name}"/>
</xsl:template>

on the following file:

<project name="...">
     <subproject name="foo"/>
     <subproject name="bar"/>
     <subproject name="baz"/>
</project>

to generate an Ant project that did what you wanted...

Matt Foemmel
ThoughtWorks, Inc.


|--------+------------------------------------->
|        |          "Sergey V. Udaltsov"       |
|        |          <Sergey.Udaltsov@artificial|
|        |          -life.com>                 |
|        |          Sent by:                   |
|        |          svu@udaltsov.aliferus      |
|        |                                     |
|        |                                     |
|        |          07/11/00 07:57 AM          |
|        |          Please respond to ant-dev  |
|        |                                     |
|--------+------------------------------------->
  >-----------------------------------------------------------------------------------------------------------|
  |                                                                                      
                    |
  |       To:     ant-dev@jakarta.apache.org                                             
                    |
  |       cc:                                                                            
                    |
  |       Subject:     templates ...                                                     
                    |
  >-----------------------------------------------------------------------------------------------------------|




Hi all

What is the correct way to create "template tasks" in ant's makefiles.

For example, I would like to:
1. Create the dir ${subproject} -
2. Compile some set of files ${srcfiles} to some directory ${subproject}
using classpath ${utiljars}
3. Build ${subproject}.jar from all the files in ${subproject}
4. Clean ${subproject} - i.e. <deltree...>

And I have a lot (N) of subprojects with their own sets of sources and
utiljars.
I would like to have 4*N tasks with maximal code reuse.

How would you offer to solve this problem in most modular way?

Thanks for any ideas...

--
Sergey V. Udaltsov




Mime
View raw message