You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2008/10/28 23:08:24 UTC

svn commit: r708699 - in /ofbiz/trunk: framework/base/ant-scripts/ framework/base/ant-scripts/if-script.groovy macros.xml

Author: doogie
Date: Tue Oct 28 15:08:24 2008
New Revision: 708699

URL: http://svn.apache.org/viewvc?rev=708699&view=rev
Log:
Add a new ant task, <if><condition/><commands/><else/></if>, since
ant itself doesn't support such a construct.

Added:
    ofbiz/trunk/framework/base/ant-scripts/
    ofbiz/trunk/framework/base/ant-scripts/if-script.groovy
Modified:
    ofbiz/trunk/macros.xml

Added: ofbiz/trunk/framework/base/ant-scripts/if-script.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/ant-scripts/if-script.groovy?rev=708699&view=auto
==============================================================================
--- ofbiz/trunk/framework/base/ant-scripts/if-script.groovy (added)
+++ ofbiz/trunk/framework/base/ant-scripts/if-script.groovy Tue Oct 28 15:08:24 2008
@@ -0,0 +1,8 @@
+def condition = elements.condition
+def commands
+if (condition[0].eval()) {
+ commands = elements.commands
+} else {
+ commands = elements.else
+}
+if (commands && !commands.isEmpty()) commands[0].execute()

Modified: ofbiz/trunk/macros.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/macros.xml?rev=708699&r1=708698&r2=708699&view=diff
==============================================================================
--- ofbiz/trunk/macros.xml (original)
+++ ofbiz/trunk/macros.xml Tue Oct 28 15:08:24 2008
@@ -52,4 +52,10 @@
    -->
   </default-javac>
  </presetdef>
+
+ <scriptdef name="if" language="groovy" src="${ofbiz.home.dir}/framework/base/ant-scripts/if-script.groovy" classpathref="groovy.class.path">
+  <element name="condition" classname="org.apache.tools.ant.taskdefs.condition.And"/>
+  <element name="commands" classname="org.apache.tools.ant.taskdefs.Sequential"/>
+  <element name="else" classname="org.apache.tools.ant.taskdefs.Sequential"/>
+ </scriptdef>
 </project>