ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <>
Subject Re: Building modular software
Date Fri, 12 Jan 2001 12:55:54 GMT
At 12:39  12/1/01 -0000, Calum Maclean wrote:
>I'd like to use hierarchical build files to manage this.  I've read some
>previous mails on this subject, but I have a couple of specific questions:

In Ant1.x I almost invariably recommend a monolithic build file for this
and to avoid hierarchial build files at all costs. The reason is that
Ant1.x doesn't deal well with this situation thou it will change for
Ant2.0. There are a few people who differen in opinion though so YMMV ;)

>1. How do I manage dependencies between different build.xml files?  For
>example, module A in build1.xml might depend on module B in build2.xml.  If
>there was just one build.xml file, I could just put B in the "depends"
>attribute of target A.  How do I manage such a scenario with multiple build

With great difficulty - you have to do the main dependancy stuff in top
level file unfortunately.

>It might be nice if I could do <target name="A" depends="build2.xml.B">...
>(I know I can't...)

Ant2.0 will allow this thou not yet so ;(

>2. How do I manage the various suites of products without duplicating files?
>For example, I might have 3 products P1, P2 and P3 and want to release any
>combination of these.  How do I use a single build file to manage this?
>My first thought is that the main target for, say, P1 has an "if" attribute
>called "P1".  So this product is only built if I set this property when I
>run Ant on this build file.  In this scenario, I might have:
><target name="P1" if="P1"> ...
><target name="P2" if="P2"> ...
><target name="P2" if="P2"> ...
><target name="all" depends="P1,P2,P3>...
>so that I always run Ant on the "all" target, and configure what gets built
>by setting the properties externally.

right. Thats possibly the best way to do it at the moment and read in
properties for a particular run from a file. Personally I actually build
everything and then just selectively jar up different packages.

>Another thought is that I choose what targets to run Ant on, e.g. specify
>"P1" and "P2" when running Ant if I want P1 and P2.  I'd then probably have
>to have a further target to build the overall package, in terms of building
>an installer etc.
>Are there better ways to achieve this sort of thing?

Not yet - there will be in the future hopefully thou ;)



| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |

View raw message