ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <>
Subject RE: if and unless attributes for all Tasks
Date Fri, 18 May 2001 18:11:14 GMT
> From:
> We have 31 different modules all maintained by CVS. We have
> several different
> products that can include any combination of the 31 CVS
> modules.  We need a
> process that can build any of the products (i.e. any
> combination of modules)
> based on CVS tag.  We also need a module level build process
> for each module
> that understands how to build just that particular module.
> We have also
> defined default targets that all build files (both product
> and module) must
> support. These are clean, fetch, compile, test, docs,
> package, and deploy.
> Given this we defined a two level system.  At the highest
> level we have one
> build file that understands all possible modules.  This is
> called the root
> build.  The root build coordinates the build of each module
> based on the
> target called.  For example, a root clean will call all clean
> targets for
> each module checked out.  To understand weather or not a
> module's build
> targets can be called from the root build, I use a target
> that checks each
> module for a build file and set a property if it is available
> to be called
> with an ant tasks. After checking all modules build
> availability, I need to
> conditionally call the ant task for each module, thus the
> if/unless for
> tasks.
> Without if/unless for tasks and using the most frequently offered
> alternative, I would need to wrap all 31 ant calls in a
> target.  Plus each
> module supports 6 default targets.  So now I have 186 (31 x
> 6) wrapped tasks
> in their own target, all just to get conditional processing
> of an ant task.
> I am sure this is not what is meant by a target.

Maybe the problem is that you are abstracting your build the wrong way.
Why are you trying to put the ifs at the top level build file?

In my opinion the top buildfile, should:

(1) set properties for modules that do not need to be build.
    <property name="exclude.moduleX" value="true" />

(2) call the corresponding top level target of all the modules:
    <ant dir="moduleX" target="build" />
    <ant dir="moduleY" target="build" />

Each module build file default rule is of the form:
    <target name="build" ..... unless="exclude.moduleX" >

There is no need for 186 combinations or funny one liners. Is just putting
the burden of the decision on the right place.

Jose Alberto

View raw message