ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jimmy Han" <j...@cisco.com>
Subject Re: Can ant do this?
Date Tue, 21 May 2002 20:52:30 GMT
I expect ant to be better than make and will replace make.
However I found a few features that ant is missing.

<foreach> is one. Look at the following extracts from the
tomcat/catalina/build.xml

<!-- Common Extensions -->
<mkdir dir="${catalina.dist}/common/classes"/>
<copy todir="${catalina.dist}/common/classes">
  <fileset dir="${catalina.build}/common/classes" />
</copy>
<mkdir dir="${catalina.dist}/common/lib"/>
<copy todir="${catalina.dist}/common/lib">
  <fileset dir="${catalina.build}/common/lib" />
</copy>
......
<mkdir dir="${catalina.dist}/lib"/>
<copy todir="${catalina.dist}/lib">
  <fileset dir="${catalina.build}/lib" />
</copy>

It should really be something like
<property name="distdir" value="common/classes common/lib ... lib" />

<foreach list="${distdir}" param="dir">
    <mkdir dir="${catalina.dist}/${dir}"/>
    <copy  todir="${catalina.dist}/${dir}">
         <fileset dir="${catalina.build}/${dir}"/>
    </copy>
</foreach>

And the clean target should be
<foreach list="${distdir}" param="dir">
    <delete dir="${catalina.dist}/${dir}"/>
</foreach>

Another is the ability of recursive property resolution. For example

${${project}.build}

IMHO, for a large dev project with many loosely coupled sub-projects,
these features are really necessary.

-
Jimmy

----- Original Message ----- 
From: "Erik Hatcher" <jakarta-ant@ehatchersolutions.com>
To: "Ant Users List" <ant-user@jakarta.apache.org>
Sent: Monday, May 20, 2002 4:38 PM
Subject: Re: Can ant do this?


> It can, sort of.  But not easily or very straightforwardly at the moment.
> For one, Ant does not provide the target(s) being executed to the build
> file. You can pull off things similiar with these tricks:
> 
> - Execute Ant using the default target, but use -Dtarget=... to force a
> pseudo-target and then <antcall> to it or use ${target} any way you like.
> 
> - Use the Sourceforge ant-contrib <foreach> task to fire a build for ever
> directory in a list - and combined with the -Dtarget trick you could fire
> that target using <ant>.
> 
> Ant is not make, make is not Ant.  Ant currently does not do well with the
> recursive build scenarios that many make folks expect. The idea being that
> Ant is automatically recursive in its tasks, such as <javac> compiling an
> entire directory tree of code and other tasks that will process full
> directory trees also.  So one build file can often replace many makefiles.
> 
>     Erik
> 
> 
> ----- Original Message -----
> From: "Jimmy Han" <jhan@cisco.com>
> To: <ant-user@jakarta.apache.org>
> Sent: Monday, May 20, 2002 5:53 PM
> Subject: Can ant do this?
> 
> 
> > I am a new ant user. I wonder if ant can do this as "make".
> >
> > SUB_PROJECTS=proj1 proj2 ...
> >
> > targets:
> > [@
> >         for project in ${SUB_PROJECTS}; do
> >                  blah blah $${project}
> >         done
> > ]
> >
> > clean:
> > [@
> >         for project in ${SUB_PROJECTS}; do
> >                  clean blah blah $${project}
> >         done
> > ]
> >
> > I will be pretty disappointed if the answer is "No".
> >
> > -
> > Jimmy
> >



--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message