view groovy-ant.xml @ 48:561ece0a8225

Return to using snapshot resolver to ensure ivy.xml file from dependency can be found and improve performance and tracbility. removed changing from chain. Modified local to be treated as local.
author smith@nwoca.org
date Thu, 16 Jun 2011 17:26:39 -0400
parents 714576165aba
children 5d200e63ba1a
line wrap: on
line source
<?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">
 
    <description>Ant tasks shared by Groovy based NetBeans projects.</description>

    <!-- Following targets  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"/>
    <target name="-do-test-run"         depends="init,compile-test,-pre-test-run,-groovy-do-test-run" if="have.tests" />
    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>
                <property name="jacoco.coverage.agent" value=""/>
                <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 depends="init,compile-test,-pre-test-run" if="have.tests" name="-groovy-do-test-run">
        <property name="groovy.test.includes" value="**/*Test.*"/>
        <j2seproject3:junit testincludes="${groovy.test.includes}"/>
    </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>