diff groovy-ant.xml @ 63:5d200e63ba1a

USASR-644: update to compile groovy source for web projects
author smith@nwoca.org
date Wed, 12 Oct 2011 13:06:17 -0400
parents 714576165aba
children 9dcb429eea14
line wrap: on
line diff
--- a/groovy-ant.xml	Tue Sep 27 14:23:43 2011 -0400
+++ b/groovy-ant.xml	Wed Oct 12 13:06:17 2011 -0400
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project name="groovy-project-tasks" default="all" basedir="."
-        xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3">
+        xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3"
+        xmlns:ssdtant="antlib:org.ssdt_ohio.tools.ant">
  
     <description>Ant tasks shared by Groovy based NetBeans projects.</description>
 
@@ -11,20 +12,27 @@
     <target name="-do-test-run"         depends="init,compile-test,-pre-test-run,-groovy-do-test-run" if="have.tests" />
     end copy -->
 
+<!--    <ssdtant:replace-target target="javadoc-build" with="groovydoc"/>-->
+    <ssdtant:replace-target target="-javadoc-build" with="groovydoc"/>
+    <ssdtant:replace-target target="-init-macrodef-junit" with="-init-macrodef-junit-groovy"/>
+    <ssdtant:replace-target target="-do-test-run" with="-groovy-do-test-run"/>
+    <ssdtant:replace-target target="-init-macrodef-javac" with="-groovy-init-macrodef-javac-groovyc"/>
+
     <target depends="init" name="groovydoc">
+        <echoproperties prefix="ivy"/>
         <taskdef name="groovydoc"
                  classname="org.codehaus.groovy.ant.Groovydoc"
-                 classpath="${javac.classpath}"/>
+                 classpath="${run.classpath}"/>
         <mkdir dir="${dist.javadoc.dir}"/>
-        <groovydoc
+        <groovydoc 
             destdir="${dist.javadoc.dir}"
             sourcepath="${src.dir}"
             windowtitle="${javadoc.windowtitle}"
             use="${javadoc.use}"
             private="${javadoc.private}"
             author="${javadoc.author}"
-            doctitle="${javadoc.windowtitle}">
-            <link packages="java.,org.xml.,javax.,org.xml." href="http://java.sun.com/javase/6/docs/api/"/>
+            doctitle="${javadoc.windowtitle}" >           
+            <link packages="java.,org.xml.,javax.,org.xml." href="http://download.oracle.com/javase/6/docs/api/"/>
             <link packages="org.apache.ant.,org.apache.tools.ant." href="http://www.dpml.net/api/ant/1.7.0"/>
             <link packages="org.junit.,junit.framework." href="http://junit.sourceforge.net/junit3.8.1/javadoc/"/>
             <link packages="groovy.,org.codehaus.groovy." href="http://groovy.codehaus.org/api/"/>
@@ -37,7 +45,10 @@
             <attribute default="${excludes}" name="excludes"/>
             <attribute default="**" name="testincludes"/>
             <sequential>
+                <property name="work.dir" value="${basedir}"/>
                 <property name="jacoco.coverage.agent" value=""/>
+                <property name="run.jvmargs" value=""/>
+                <property name="j2ee.platform.classpath" value=""/>                
                 <if>
                     <isset property="java.agent.jar"/>
                     <then>
@@ -60,7 +71,7 @@
                         </fileset>
                     </batchtest>
                     <classpath>
-                        <path path="${run.test.classpath}"/>
+                        <path path="${run.test.classpath}:${j2ee.platform.classpath}"/>
                     </classpath>
                     <syspropertyset>
                         <propertyref prefix="test-sys-prop."/>
@@ -95,6 +106,7 @@
             <attribute default="" name="apgeneratedsrcdir"/>
             <element name="customize" optional="true"/>
             <sequential>
+                <echo message="using groovyc joint compiler (jse)"/>
                 <taskdef name="groovyc" classpath="${javac.classpath}" classname="org.codehaus.groovy.ant.Groovyc"/>
                 <property name="empty.dir" location="${build.dir}/empty"/>
                 <mkdir dir="${empty.dir}"/>
@@ -114,5 +126,56 @@
                 </groovyc>
             </sequential>
         </macrodef>
+        
+        <macrodef name="javac" uri="http://www.netbeans.org/ns/web-project/2">
+            <attribute default="${src.dir}" name="srcdir"/>
+            <attribute default="${build.classes.dir}" name="destdir"/>
+            <attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
+            <attribute default="${javac.processorpath}" name="processorpath"/>
+            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
+            <attribute default="${includes}" name="includes"/>
+            <attribute default="${excludes}" name="excludes"/>
+            <attribute default="${javac.debug}" name="debug"/>
+            <attribute default="${empty.dir}" name="gensrcdir"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <echo message="using groovyc joint compiler (web)"/>
+                <taskdef name="groovyc" classpath="${javac.classpath}" classname="org.codehaus.groovy.ant.Groovyc"/>
+                <property location="${build.dir}/empty" name="empty.dir"/>
+                <mkdir dir="${empty.dir}"/>
+                <groovyc fork="true" srcdir="@{srcdir}" sourcepath="@{sourcepath}" destdir="@{destdir}" encoding="${source.encoding}" includes="@{includes}" excludes="@{excludes}" includeAntRuntime="false">
+                    <src>
+                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
+                            <include name="*"/>
+                        </dirset>
+                    </src>
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <javac debug="@{debug}" deprecation="${javac.deprecation}" encoding="${source.encoding}" source="${javac.source}" target="${javac.target}">
+                        <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
+                        <customize/>
+                    </javac>
+                </groovyc>
+                         
+<!--                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}" target="${javac.target}">
+                    <src>
+                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
+                            <include name="*"/>
+                        </dirset>
+                    </src>
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <compilerarg line="${javac.compilerargs}"/>
+                    <customize/>
+                </javac>
+-->
+            </sequential>
+        </macrodef>
+        
+        
+        
     </target>
 </project>