svn commit: r997425 - in /ofbiz/trunk: build.xml common.xml macros.xml tools/If-ant.py tools/src/org/ofbiz/tools/ant/IfTask.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r997425 - in /ofbiz/trunk: build.xml common.xml macros.xml tools/If-ant.py tools/src/org/ofbiz/tools/ant/IfTask.java

doogie-3
Author: doogie
Date: Wed Sep 15 17:57:06 2010
New Revision: 997425

URL: http://svn.apache.org/viewvc?rev=997425&view=rev
Log:
Use a script instead of a class for <if>; no longer have to compile anything.

Added:
    ofbiz/trunk/tools/If-ant.py
Removed:
    ofbiz/trunk/tools/src/org/ofbiz/tools/ant/IfTask.java
Modified:
    ofbiz/trunk/build.xml
    ofbiz/trunk/common.xml
    ofbiz/trunk/macros.xml

Modified: ofbiz/trunk/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/build.xml?rev=997425&r1=997424&r2=997425&view=diff
==============================================================================
--- ofbiz/trunk/build.xml (original)
+++ ofbiz/trunk/build.xml Wed Sep 15 17:57:06 2010
@@ -35,10 +35,6 @@ under the License.
 
     <target name="ofbiz-init">
         <property environment="env"/>
-        <mkdir dir="tools/build/classes"/>
-        <javac srcdir="tools/src" debug="on" deprecation="off" destdir="tools/build/classes" compiler="javac1.5" target="1.5" source="1.5"/>
-        <mkdir dir="tools/build/lib"/>
-        <jar jarfile="tools/build/lib/ofbiz-tools.jar" basedir="tools/build/classes"/>
     </target>
 
     <!-- ================================================================== -->
@@ -61,7 +57,6 @@ under the License.
         <antcall target="clean-cache"/>
         <antcall target="clean-tempfiles"/>
         <antcall target="clean"/>
-        <antcall target="clean-tools"/>
     </target>
 
     <target name="clean-data"
@@ -157,10 +152,6 @@ under the License.
         <echo message="[clean] ========== Done Cleaning =========="/>
     </target>
 
-    <target name="clean-tools">
-        <delete dir="tools/build"/>
-    </target>
-
     <target name="svninfo"
         description="Update the Release-revision info in the footer. Note that you need a valid Internet connection and Subversion connected to the OFBiz repository for that ">
         <echo message="Creating svninfo..."/>

Modified: ofbiz/trunk/common.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/common.xml?rev=997425&r1=997424&r2=997425&view=diff
==============================================================================
--- ofbiz/trunk/common.xml (original)
+++ ofbiz/trunk/common.xml Wed Sep 15 17:57:06 2010
@@ -26,7 +26,6 @@ under the License.
     <property name="dtd.dir" value="dtd"/>
     <property name="lib.dir" value="lib"/>
     <property name="build.dir" value="build"/>
-    <taskdef name="if" classname="org.ofbiz.tools.ant.IfTask" classpath="${ofbiz.home.dir}/tools/build/classes"/>
 
     <path id="test.class.path">
         <path refid="local.class.path"/>

Modified: ofbiz/trunk/macros.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/macros.xml?rev=997425&r1=997424&r2=997425&view=diff
==============================================================================
--- ofbiz/trunk/macros.xml (original)
+++ ofbiz/trunk/macros.xml Wed Sep 15 17:57:06 2010
@@ -52,6 +52,9 @@ under the License.
   <pathelement location="${ofbiz.home.dir}/framework/base/lib/scripting/asm-3.2.jar"/>
   <pathelement location="${ofbiz.home.dir}/framework/base/lib/scripting/groovy-all-1.7.4.jar"/>
  </path>
+ <path id="rhino.class.path">
+  <pathelement location="${ofbiz.home.dir}/extension/rhino/lib/js-1.7.R1.jar"/>
+ </path>
  <path id="ant.lib.class.path">
   <pathelement location="${ofbiz.home.dir}/framework/base/lib/ant/ant-nodeps-1.7.1.jar"/>
  </path>
@@ -152,6 +155,12 @@ under the License.
   </groovyc>
  </presetdef>
 
+ <scriptdef name="if" language="javascript" classpathref="rhino.class.path" loaderref="rhino.class.path.loader" src="${ofbiz.home.dir}/tools/If-ant.py">
+  <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>
+
  <taskdef name="javacc" classname="org.apache.tools.ant.taskdefs.optional.javacc.JavaCC" classpath="${ofbiz.home.dir}/framework/base/lib/ant/ant-nodeps-1.7.1.jar"/>
  <taskdef name="jjtree" classname="org.apache.tools.ant.taskdefs.optional.javacc.JJTree" classpath="${ofbiz.home.dir}/framework/base/lib/ant/ant-nodeps-1.7.1.jar"/>
  <macrodef name="ofbiz-javacc">

Added: ofbiz/trunk/tools/If-ant.py
URL: http://svn.apache.org/viewvc/ofbiz/trunk/tools/If-ant.py?rev=997425&view=auto
==============================================================================
--- ofbiz/trunk/tools/If-ant.py (added)
+++ ofbiz/trunk/tools/If-ant.py Wed Sep 15 17:57:06 2010
@@ -0,0 +1,9 @@
+var seq;
+if (elements.get('condition').get(0).eval()) {
+   seq = elements.get('commands');
+} else {
+   seq = elements.get('else');
+}
+if (seq) {
+    seq.get(0).execute();
+}