ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Price <>
Subject Re: How to handle conditional capabilities?
Date Mon, 31 Mar 2003 16:13:32 GMT

Duffey, Kevin wrote:
> Hi all,
> I am using Eclipse 2.1 (just released) and Ant 1.5.1. I have like 8 build scripts, one
for development, one for a clean build, one to build and package, and so forth. What I would
like to do is consolidate into one build file since most of the build files are the same.
I am fairly familiar with the basics of ant as I have been using it for a few years. I haven't
done anything like what I want to do now. Basically, I want to be able to pass in some parameters
that set properties. I may have something like:
> <property name="version" value="1.2"/>
> <property name="build.type" value="clean"/>
> What I would like to do is somehow something like:
> If (build.type == "clearn")
> {
>   <delete all dirs>
> }
> else if (build.type == "dev")
> {
>   <compile only changes>
> }
> the properties, the compiling of source, etc is the same for all my build files so either
a single build file, or perhaps some links to how to make pretty solid build scripts for different
types of builds would be very helpful.

There seems to be two ways to do this if I understand you correctly. 
One way is to do exactly what you propose by setting properties on the 
command line or in files and using the "if" attribute 
of many of the tasks to conditionally execute them.

But it seems more like you would want to create a separate target for 
each of these goals, and then simply specify the target you wish to 
execute from the command line (?).  Am I just not understanding the 


View raw message