You can look into ant's script task to facilitate this type of "complicated" logic.  
In the javascript (if you choose) you can check values of properties and then choose 
the route of execution.  There's probably ant contrib tasks also for handling if 
conditions based on the value of a property.
 

-----Original Message-----
From: Rhino [mailto:[EMAIL PROTECTED]
Sent: Friday, October 15, 2004 9:09 AM
To: ant-user
Subject: Perform different target depending on *value* of property


I want to revise an existing script so that it does a different target for each of 
several different *values* of a property.
 
For example, if the property, which is named 'server' has a value of "foo", I want the 
script to execute a target called "foo-upload". If the value of 'server' is "bar", I 
want the script to execute a target called "bar-upload". If the value of 'server' is 
"test", I want the script to execute a target called "test-upload".
 
Actually, although the target names begin with the server name, that is more 
convenience than necessity; it isn't critical that the target names start with the 
server name so I don't insist on that.
 
I am running Ant 1.6.1 but would be willing to upgrade to a newer version to 
accomplish this. I would also like to stay "pure Ant" if possible but would still be 
interested in seeing solutions using optional tasks or ant-contrib.
 
I know that 'if' and 'unless' are the normal mechanisms for enabling conditional 
execution of tasks but they only seem to work on the basis of if a property is enabled 
or not, rather than on the VALUE of the property.
 
Rhino
---
rhino1 AT sympatico DOT ca
"There are two ways of constructing a software design. One way is to make it so simple 
that there are obviously no deficiencies. And the other way is to make it so 
complicated that there are no obvious deficiencies." - C.A.R. Hoare

Reply via email to