ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject RE: Passing in parameters (IF statement question)
Date Tue, 18 Sep 2001 17:00:43 GMT

It's a little hard to advise you, since you haven't given much detail on
what your build-file does (eg., what effect setting your "environmentN"
properties has on the build). I'm not sure why you need the batch-file or
what your in-house task does, but if you want to keep going with what you
have so far, the question is: Why are you going through ${environment1} in
your batch-file instead of just transforming the command-line "ps" to
"\\production\stage" to begin with? (My suspicion is you might be going a
long way around to do something that could be done more easily.) In any
case, if you're using Ant 1.4, you can use the <condition> task to set the
value of your "ps", "pl", etc. properties by using the <equal> tag to test
what ${environment1} is set to (although, again, I suspect you may be
going down a more convoluted path than you need to).


--- "Pugh, Eric" <> wrote:
> I guess after reading and playing with some of the changes suggested, I
> am getting closer to defining what i want!
> I took Erik's suggestion, and created a batch file wrapper.  I have a
> task called compare that invokes Beyond Compare to do a comparison of
> some file directories.  My batch file takes in a "short name" for each
> enviroment. In other workds pl means production live.  ps means
> production stage.  I have properties definied in my build.xml:
> 	${ps}  = \\production\stage
> 	${pl}  = \\production\live
> These two parameters are passed into my ant compare task via the batch
> file. Excellent so far, I can call bc.cmd ps pl and ant will get called
> with two paramters set:  ant compare -Denviroment1=ps -Denviroment2=pl.
> Then in my ant task that exec's the BeyondCompare.exe I pass the two
> short names: ${enviroment1}.  However, what I am now discovering is that
> I am executing this command:  
> 	c:\beyondcompare.exe pl ps.  
> 	c:\beyondcompare.exe \\production\live  \\production\stage
> What I really want is to have some sort of IF statement that says
> 	IF ${enviroment1} = "ps" then
> 		${enviroment1} = ${ps}
> 	END if
> This kind of scripting I know has been banned from ANT2, under the
> theory that there are plenty of scripting tools.  So what have people
> done to make this kind of functionality work?  Use the BSF stuff?
> Eric


Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information

View raw message