view groovy-ant.xml @ 10:3c87d0aee1f9

TL-32: Modify for compatiblity with NB 6.9.1
author smith@nwoca.org
date Sat, 18 Dec 2010 21:05:20 -0500
parents ae7d512164d0
children de6f3a495afd
line wrap: on
line source
<?xml version="1.0" encoding="UTF-8"?>
<project name="groovy-project-tasks" default="all" basedir=".">
 
    <description>Ant tasks shared by Groovy based NetBeans projects.</description>

    <!-- Following targets may need to be copied to the build.xml. -->
    <target name="-javadoc-build" depends="groovydoc"/>
    <target name="-init-macrodef-junit" depends="-init-macrodef-junit-groovy"/>
    <target name="-pre-compile" depends="-groovy-init-macrodef-javac-groovyc"/>
    <!-- end copy -->

    <target depends="init" name="groovydoc">
        <taskdef name="groovydoc"
                 classname="org.codehaus.groovy.ant.Groovydoc"
                 classpath="${javac.classpath}"/>
        <mkdir dir="${dist.javadoc.dir}"/>
        <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/"/>
            <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/"/>
        </groovydoc>
    </target>

    <target name="-init-macrodef-junit-groovy">
        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
            <attribute default="${includes}" name="includes"/>
            <attribute default="${excludes}" name="excludes"/>
            <attribute default="**" name="testincludes"/>
            <sequential>
                <if>
                    <isset property="java.agent.jar"/>
                    <then>
                        <property name="jvm.agent" value="-javaagent:${java.agent.jar}"/>
                    </then>
                    <else>
                        <property name="jvm.agent" value=""/>
                    </else>
                </if>
                <propertyregex input="@{includes}" property="testg.includes" regexp="\.groovy" replace=".class" defaultValue="@{includes}"/>
                <junit  dir="${work.dir}"
                        errorproperty="tests.failed"
                        failureproperty="tests.failed"
                        fork="true"
                        forkmode="once"
                        showoutput="true">
                    <batchtest todir="${build.test.results.dir}">
                        <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes}" includes="${testg.includes}">
                            <filename name="@{testincludes}"/>
                        </fileset>
                    </batchtest>
                    <classpath>
                        <path path="${run.test.classpath}"/>
                    </classpath>
                    <syspropertyset>
                        <propertyref prefix="test-sys-prop."/>
                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
                    </syspropertyset>
                    <formatter type="brief" usefile="false"/>
                    <formatter type="xml"/>
                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
                    <jvmarg line="${run.jvmargs}"/>
                    <jvmarg line="${jvm.agent}"/>
                </junit>
            </sequential>
        </macrodef>
    </target>

    <target name="-groovy-init-macrodef-javac-groovyc">
        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
            <attribute name="srcdir" default="${src.dir}"/>
            <attribute name="destdir" default="${build.classes.dir}"/>
            <attribute name="classpath" default="${javac.classpath}"/>
            <attribute name="includes" default="${includes}"/>
            <attribute name="excludes" default="${excludes}"/>
            <attribute name="debug" default="${javac.debug}"/>
            <attribute name="sourcepath" default="${empty.dir}"/>
            <attribute name="gensrcdir" default="${empty.dir}"/>
            <attribute default="" name="processorpath"/>
            <attribute default="" name="apgeneratedsrcdir"/>
            <element name="customize" optional="true"/>
            <sequential>
                <taskdef name="groovyc" classpath="${javac.classpath}" classname="org.codehaus.groovy.ant.Groovyc"/>
                <property name="empty.dir" location="${build.dir}/empty"/>
                <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>
            </sequential>
        </macrodef>
    </target>
</project>