ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gle...@ca.ibm.com
Subject Re: templates ...
Date Tue, 11 Jul 2000 13:28:45 GMT




Try the following:

<target name="all" depends="build_blah_project,build_foo_project">
</target>

<target name="build_blah_project">
  <ant antfile="build_tmpl.xml" >
    <property name="subproject" value="blah"/>
    <property name="src" value="blah/src" />
    ...
  </ant>
</target>

<target name="build_foo_project">
  <ant antfile="build_tmpl.xml">
    <property name="subproject" value="foo" />
    <property name="src" value="foo/src" />
    ...
  </ant>
</target>

where build_tmpl.xml does all the stuff you mention below.  Your parent
build would have a series of

The only caveat is that the properties you specify in the ant task can't
already exist in the parent project.  There is a limitation/feature to
ensure that once a property is set, it can't be overriden.  The ant task
first copies all the existing properties into its new project, and then
adds its local properties to the mix.

Glenn McAllister
TID - Software Developer - VisualAge for Java
IBM Toronto Lab, (416) 448-3805
"An approximate answer to the right question is better than the
right answer to the wrong question." - John W. Tukey


Please respond to ant-dev@jakarta.apache.org

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