ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geoff Meakin" <geo...@isocra.com>
Subject RE: conditional compilation 2
Date Fri, 21 Jun 2002 10:13:12 GMT
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:tda@quasarlabs.com]
Sent: 21 June 2002 11:02 AM
To: ant-user@jakarta.apache.org
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:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message