You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Klein, Scott @ TW" <sc...@L-3com.com> on 2002/11/13 18:53:43 UTC

conditions and property's

OK. So I have determined that Ant is currenty not capable of doing the
following within a single task (if I'm wrong, please correct me):
	if condition exists, do stuff
	else stop executing script

however, in order to make my targets re-useable for a variety of purposes I
require my properties to be UNset after they are checked:
	<target name="checkErrorForFoo" unless="bar">
		<fail /> 
	</target>

	<target name="foo" if="bar">
		.. do some stuff ..
		?? unset the property bar ??
	</target>

	<target name="foobar">
		<condition name="bar">
			.. whatever ..
		</condition>
		<antcall target="checkErrorForFoo">
		<antcall target="foo">

		<condition name="bar">
			.. whatever ..
		</condition>
		<antcall target="checkErrorForFoo">
		<antcall target="foo">
	</target>

So I only want target "foo" to execute under certain conditions, however
once the property is set there is no way to unset it. Say I want foo to be
copyFile then I need to have copyFileForTarget1 copyFileForTarget2 - plus
all of the properties and error checks (which is another story).

I've read that something much easier is being promised in Ant2, but
shouldn't simple logic be supported already? It just seems strange to me
that it is not.

Anyway, if there is a simple solution to this that I've missed I would love
to hear about it.


thanks
scott

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>