ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phillip Lord <p.l...@russet.org.uk>
Subject Re: Using Ant with a Modular System Design
Date Thu, 28 Aug 2003 16:51:36 GMT
>>>>> "David" == David McTavish <dmctavish@sandvine.com> writes:

  David> but does your tool allow all of the build files to have
  David> targets with the same name? 

Yes. The build files are all generated, is the point. You get an
inheritance of sorts, so sub class build files will over ride the
behaviour of the child. 

  David> ie: all build files in this example should have a "compile"
  David> target that compiles the code. If you merge the files, aren't
  David> you going to have collisions?


The way it would work is that you would generate a parental file with
the targets common stuff in them, and then all the children would
inherit these. 

In this specific case the OP wanted to have a sub file automatically
build all the other modules that the current one depends on. The way
that I would do this is write a task that builds modules dependent on
a property which you could do easily using something like
foreach. Then I would set the property in the child build. And finally
I would make "compile" and all similar targets depend on this.

So you might have

property name dependencies value=""

compile depends on pre-build

pre-build 
  foreach ${i} dependencies
        ant build = ../${i}/build.xml



in the super class file, and then in the child you would have...

property name dependencies value="a,b,c"

and it will inherit the targets which perform the build from the
parent. 


In our project we have done something a little simpler where
dependencies do not get automatically build, but do get picked up from
a standard place. 

So we have a "publish" target which following the build of a module
copies the jar to a known location. Then another module will say "I
depend on a.jar". A target I call "gather" will then pick these jars
up from this location. 

This gives a bit of freedom between modules. You only get a new
version when you really want it, although it can of course leave the
system in an inconsistent state, which is less than perfect. But then
again is anything ever perfect!

The antmerge tool however just provides the inheritance. It doesn't
solve all the problems of the build. But at least it does mean that
you don't have to replicate large amounts of ant code in a modular
build, which I have tended to find the case otherwise. 

Phil


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


Mime
View raw message