One simple way to do it is:

<task name="check_conditions">
<condition property="both_os" value="true"><and><equals arg1="LINUX"
arg2="1"/><equals arg1="WINDOWS" arg2="1"/></and></condition>
</task>

<task name="fail_on_both_os" if="both_os">
  <fail message="Bad arguments- Both LINUX and WINDOWS are set"/>
</task>

<task name="starthere" depends="check_conditions,fail_on_both_os">
  do stuff
</task>


However there are better ways to do what you're doing. Check out the
property os.name for example.

Cheers
-Geoff



-----Original Message-----
From: Dmitry Trunikov [mailto:[EMAIL PROTECTED]]
Sent: 21 June 2002 11:02 AM
To: [EMAIL PROTECTED]
Subject: conditional compilation 2


    Hi ALL!
I checked mail archive but didn't find answer for my question.
My problem is following. I have java application that is built by ant.
Application is OS depended therefore I pass target  OS as build
property: ant -DLINUX=1 or ant -DWINDOWS=1. I would like to add to
build.xml some code that can does validation of input properties for
mutual exclusion,  i.e. command for build: ant -DLINUX=1 -DWINDOWS=1 is
not valid.

Thanx.


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to