Creating something similar to if-statements using ANT
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jonas_Pavletic
Posted On:   Wednesday, March 2, 2005 03:49 AM

I'm trying to create something similar to an if-statement in my ANT buildfile, but so far no luck... Below is what I have today which, allthough in error, will give you an idea of what I'm trying to perform: target: checkBuildParameters - - - - - - - - - - - - - - - - - --> target: -setVSSProperties - - - - - - - - - - - - - - - - - --> Current value of ssdir = ${ssdir} target: -setVSSPath1 - - - - - - - - - - - - - - - - -    More>>

I'm trying to create something similar to an if-statement in my ANT buildfile, but so far no luck...

Below is what I have today which, allthough in error, will give you an idea of what I'm trying to perform:

			
























Current value of ssdir = ${ssdir}






-setVSSPath1 executing





-setVSSPath2 executing







Basically I want to have access to the parameter ${ssdir} which I want to set depending on the VSS location of the current PC running the buildfile.


My problem at the moment, or one of them anyway, is that parameters set in an ANT subtask are outside the scope of the calling task. This leads to my code to terminate by the fail-statement even though -setVSSPath1 actually sets the value of ssdir but the value is not in scope when the fail-task executes.

Hence I actually have two questions:


  1. Is it possible to modify the scope of parameters set in subtasks in order to enable them to be accessed from the calling task?

  2. How do you create a standard if-statement using ant?

Any ideas? Feel free to throw away all my code and present a completely different (and working) solution since I'm kind of stuck at the moment...

Thanks!

/Jonas

   <<Less

Re: Creating something similar to if-statements using ANT

Posted By:   Chris_McFarland  
Posted On:   Monday, April 18, 2005 11:21 AM

1. You can do this, using AntCallBack task from ant-contrib (http://sourceforge.net/projects/ant-contrib)


2. You might not event want to do #1 once you see an example of ant-contrib task (http://sourceforge.net/projects/ant-contrib)

Re: Creating something similar to if-statements using ANT

Posted By:   Anonymous  
Posted On:   Friday, March 4, 2005 03:10 AM

1: you cant - workaround: using external property files for return values


2: is the usual way. If you really want to think procedural then using task from AntContrib

About | Sitemap | Contact