ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Multiple Properties for the "unless" Attribute
Date Tue, 14 May 2002 16:56:37 GMT
OK, while something else was running, I did played around with your problem.
While the logic I'm using is probably all wrong, it demonstrate how you can
simulate an 'unless' depending on multiple properties. In the build.xml
below, the 'test' target will *not* executes if both c1 and c2 are defined.

I repeat, the logic I'm using is all wrong, but you should get the idea.
--DD

<?xml version="1.0"?>

<!-- ANT build file to test a specific feature or bug of ANT.
     Dominique Devienne <ddevienne@lgc.com>          May 2002
  -->
<project name="unlessx" default="test" basedir=".">

  <target name="test"
          depends="check-c1-c2"
		  unless="c1-c2">
    <echo message="firing!" />
  </target>

  <target name="check-c1-c2">
    <condition property="c1-c2">
	  <not>
	    <or>
	      <equals arg1="${c1}" arg2="$${c1}" />
	      <equals arg1="${c2}" arg2="$${c2}" />
	    </or>
	  </not>
	</condition>
  </target>

</project>

P:\org_apache\antx>ant -q -f unlessx.xml
     [echo] firing!

BUILD SUCCESSFUL

Total time: 0 seconds
P:\org_apache\antx>ant -q -f unlessx.xml -Dc1=1
     [echo] firing!

BUILD SUCCESSFUL

Total time: 0 seconds
P:\org_apache\antx>ant -q -f unlessx.xml -Dc2=1
     [echo] firing!

BUILD SUCCESSFUL

Total time: 0 seconds
P:\org_apache\antx>ant -q -f unlessx.xml -Dc1=1 -Dc2=1

BUILD SUCCESSFUL

Total time: 0 seconds
P:\org_apache\antx>

-----Original Message-----
From: Dominique Devienne [mailto:DDevienne@lgc.com] 
Sent: Tuesday, May 14, 2002 11:10 AM
To: 'Ant Users List'
Subject: RE: Multiple Properties for the "unless" Attribute

No you cannot. OTOH, you can add a dependent target that uses <condition>
with <and>/<or>/<equals> to your licking to set your 'unless' property or
not. Cryptic, but I'm busy ;-) --DD

-----Original Message-----
From: Holger Rauch [mailto:Holger.Rauch@heitec.de] 
Sent: Tuesday, May 14, 2002 11:01 AM
To: ant-user@jakarta.apache.org
Subject: Multiple Properties for the "unless" Attribute

Hi!

Is it possible to specify multiple property names at once (separated by
commas) for the "unless" attribute of a <target>. (I would like to verify
the existence of more than one property at once.)

TIA for any advice!

Kind regards,

	Holger



--
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>

--
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