ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist <>
Subject Re: How to?: add target dependencies
Date Fri, 11 Feb 2005 17:46:44 GMT

On Feb 10, 2005, at 11:41 AM, Matt Benson wrote:

> Looks like your main question is how to accumulate,
> then iterate, over these modules.

Pretty much, except for two things:

1) Stylistically, I'd prefer to that the iteration be implicit rather 
than explicit, i.e. a declarative style...

2) I'd like to have individual targets for the modules that I can run 
from the top level, e.g. "ant modules:module:foo".

If I had those targets and could also somehow create

	<target name="modules:build-all" depends="modules:module:foo, 
modules:module:bar, modules:module:baz" />

...which is really what I had in mind for (1).

But if I gotta use explicit iteration then so be it, see below...

>   It looks as though
> ant-contrib has some helpful tasks.  You could set a
> new property for each of your modules:
> or whatever.  Then it appears you could use
> ant-contrib's propertyselector task with a select
> attribute value of "$${\0}" (you might have to
> experiment).  This should get you a single property
> containing the property-expansion notation of all
> matching properties.  You can then use this list as
> input to ant-contrib's for task, calling your macro
> for each module name.

OK, well I finally got the chance to open up this ant-contrib box... 
:-)  and here's what I came up with:

In build.xml:

   <!-- Modules -->

   <import file="modules.ant"/>
   <property name="modules:module:foo" value="foo" />
   <property name="modules:module:bar" value="bar" />

   <target name="modules" depends="modules:build-all"/>

...then, in modules.ant:

   <project name="modules">

  	 <taskdef resource="net/sf/antcontrib/"/>

	  <target name="">
     		<echo message=":::::::::: building module: ${name} ::::::::::" />
     		<mkdir dir="webapp/modules" />
     		<exec dir="webapp/modules" executable="ln">
       			<arg line="-sfh ${basedir}/modules/${name}/mount ${name}" />
     		<ant dir="modules/${name}" />

  	 <propertyselector property="modules:modules"

   	<target name="modules:build-all">


I still need to add the Subversion stuff, then this will be 95% of what 
I want, and the other 5% I can live without... :-)

Thanks for the suggestion!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message