svn commit: r835632 - /ofbiz/trunk/macros.xml

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

svn commit: r835632 - /ofbiz/trunk/macros.xml

doogie-3
Author: doogie
Date: Thu Nov 12 23:16:13 2009
New Revision: 835632

URL: http://svn.apache.org/viewvc?rev=835632&view=rev
Log:
Add jjtree/javacc macro wrappers.

Modified:
    ofbiz/trunk/macros.xml

Modified: ofbiz/trunk/macros.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/macros.xml?rev=835632&r1=835631&r2=835632&view=diff
==============================================================================
--- ofbiz/trunk/macros.xml (original)
+++ ofbiz/trunk/macros.xml Thu Nov 12 23:16:13 2009
@@ -64,21 +64,63 @@
   </default-javac>
  </presetdef>
 
- <!--
- <taskdef name="ofbizscriptdef" classname="org.apache.tools.ant.taskdefs.optional.script.ScriptDef">
-  <classpath refid="ant.lib.class.path"/>
- </taskdef>
- <ofbizscriptdef 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"/>
- </ofbizscriptdef>
+ <macrodef name="ofbiz-javacc">
+  <attribute name="dir"/>
+  <attribute name="file"/>
+  <attribute name="prefix" default=""/>
+  <sequential>
+   <if>
+    <not>
+     <uptodate
+      srcfile="@{prefix}src/@{dir}/@{file}.jj"
+      targetfile="@{prefix}build/gen-src/javacc/@{dir}/@{file}.java"/>
+    </not>
+    <commands>
+     <delete dir="@{prefix}build/gen-src/javacc/@{dir}"/>
+     <mkdir dir="@{prefix}build/gen-src/javacc/@{dir}"/>
+     <javacc target="@{prefix}src/@{dir}/@{file}.jj"
+      javacchome="${ofbiz.home.dir}/framework/base/lib/javacc"
+      outputdirectory="@{prefix}build/gen-src/javacc/@{dir}"/>
+     <delete dir="@{prefix}build/classes/@{dir}"/>
+    </commands>
+   </if>
+  </sequential>
+ </macrodef>
 
- <ofbizscriptdef name="ofbiz-jjtree" language="groovy" src="${ofbiz.home.dir}/framework/base/ant-scripts/ofbiz-jjtree.groovy" classpathref="groovy.class.path">
-  <attribute name="src"/>
+ <macrodef name="ofbiz-jjtree">
   <attribute name="dir"/>
   <attribute name="file"/>
-  <attribute name="gendir"/>
- </ofbizscriptdef>
- -->
+  <attribute name="prefix" default=""/>
+  <sequential>
+   <if>
+    <not>
+     <uptodate
+      srcfile="@{prefix}src/@{dir}/@{file}.jjt"
+      targetfile="@{prefix}build/gen-src/jjtree/@{dir}/@{file}.jj"/>
+    </not>
+    <commands>
+     <delete dir="@{prefix}build/gen-src/jjtree/@{dir}"/>
+     <mkdir dir="@{prefix}build/gen-src/jjtree/@{dir}"/>
+     <jjtree target="@{prefix}src/@{dir}/@{file}.jjt"
+      javacchome="${ofbiz.home.dir}/framework/base/lib/javacc"
+      outputdirectory="@{prefix}build/gen-src/jjtree/@{dir}"/>
+    </commands>
+   </if>
+   <if>
+    <not>
+     <uptodate
+      srcfile="@{prefix}build/gen-src/jjtree/@{dir}/@{file}.jj"
+      targetfile="@{prefix}build/gen-src/javacc/@{dir}/@{file}.java"/>
+    </not>
+    <commands>
+     <delete dir="@{prefix}build/gen-src/javacc/@{dir}"/>
+     <mkdir dir="@{prefix}build/gen-src/javacc/@{dir}"/>
+     <javacc target="@{prefix}build/gen-src/jjtree/@{dir}/@{file}.jj"
+      javacchome="${ofbiz.home.dir}/framework/base/lib/javacc"
+      outputdirectory="@{prefix}build/gen-src/javacc/@{dir}"/>
+     <delete dir="@{prefix}build/classes/@{dir}"/>
+    </commands>
+   </if>
+  </sequential>
+ </macrodef>
 </project>