-------- Original Message  --------
Subject: Number expression in Ant?
From: hezjing <hezj...@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-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to