ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilbert Rebhan <gil...@maksimo.de>
Subject Re: Number expression in Ant?
Date Mon, 25 Oct 2010 19:08:44 GMT
-------- Original Message  --------
Subject: Number expression in Ant?
From: hezjing <hezjing@gmail.com>
To: ant-users <user@ant.apache.org>
Date: 25.10.2010 04:31

> Hi
> 
> Imagine that I have a property with the value "100", then I want to add 50
> to it and get the result as 150.
> 
> How can I do this in Ant?

Not with vanilla ant. But there are ant addons like for example
antcontrib (development has fallen asleep since 2006) or more lately
ant-flaka.

<project xmlns:fl="antlib:it.haefelinger.flaka">
  <property name="foobar" value="100" />
  <!--  1. overwrite $foobar -->
  <fl:let>foobar ::= '${foobar}' + 50</fl:let>
  <echo>$${foobar} => ${foobar}</echo>
  <!--  declare new property  -->
  <fl:let>foobaz := '${foobar}' + 50 </fl:let>
  <echo>$${foobaz => ${foobaz}</echo>
</project>


....
[echo] ${foobar} => 100
[echo] ${foobar} + 50 => 150
[echo] ${foobaz => 200
....


For ant-flaka details,download,documentation see =
http://code.google.com/p/flaka/


Regards, Gilbert







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


Mime
View raw message