blob: f9a5b1fb61e4e879f787c444a01f459fd77f5295 [file] [log] [blame]
<project default="default" xmlns:j="jelly:core" xmlns:u="jelly:util" >
<goal name="default" prereqs="clean, groovy:make-install"/>
<goal name="rebuild" prereqs="clean" description="Rebuilds the groovy install without running the unit tests">
<j:set var="maven.test.skip" value="true"/>
<echo>Rebuilding the binary distro of Groovy without running the unit test cases</echo>
<attainGoal name="groovy:make-install"/>
</goal>
<goal name="groovy:release" description="Performs a release of the source, binary and jar distros">
<attainGoal name="site"/>
<attainGoal name="dist:deploy-bin"/>
<attainGoal name="dist:deploy-src"/>
<attainGoal name="jar:deploy"/>
</goal>
<postGoal name="dist:prepare-bin-filesystem">
<attainGoal name="groovy:make-install"/>
<echo>Copying groovy install to ${maven.dist.bin.assembly.dir}</echo>
<copy toDir="${maven.dist.bin.assembly.dir}">
<fileset dir="${groovy.install.staging.dest}">
<include name="**/*"/>
</fileset>
</copy>
</postGoal>
<goal name="run" prereqs="test:compile"
description="Runs the given compiled Groovy class">
<j:if test="${empty(name)}">
<j:set var="name" value="HelloWorld"/>
</j:if>
<echo>Running class $$name = ${name}</echo>
<java classname="${name}" fork="yes">
<classpath refid="test.classpath"/>
<arg value="${args}"/>
</java>
</goal>
<goal name="script" prereqs="test:compile"
description="Runs the given Groovy script file">
<j:if test="${empty(name)}">
<j:set var="name" value="src/test/groovy/script/HelloWorld.groovy"/>
</j:if>
<echo>Running class $$name = ${name}</echo>
<java classname="groovy.lang.GroovyShell" fork="yes">
<classpath refid="test.classpath"/>
<arg value="${name}"/>
<arg value="${args}"/>
</java>
</goal>
<goal name="console" prereqs="test:compile"
description="Runs the Groovy command console">
<java classname="groovy.ui.Console" fork="yes">
<classpath refid="test.classpath"/>
</java>
<!--
<java classname="groovy.lang.GroovyShell" fork="yes">
<arg value="src/main/groovy/ui/Console.groovy"/>
<classpath refid="test.classpath"/>
</java>
-->
</goal>
<goal name="swing:demo" prereqs="test:compile"
description="Runs the GroovySwing demo">
<java classname="groovy.swing.Demo" fork="yes">
<classpath refid="test.classpath"/>
</java>
</goal>
<preGoal name="xdoc:jelly-transform">
<copy toDir="${maven.html2xdoc.dir}">
<fileset dir="${basedir}/xdocs">
<include name="**/*.html"/>
</fileset>
</copy>
<!-- now lets run the wiki plugin -->
<attainGoal name="java:compile"/>
<attainGoal name="setclasspath"/>
<wiki2html srcdir="${basedir}/xdocs" destdir="${maven.html2xdoc.dir}"/>
<attainGoal name="html2xdoc"/>
<attainGoal name="faq"/>
</preGoal>
<postGoal name="test:compile">
<attainGoal name="setclasspath"/>
<attainGoal name="groovy:compile-tests"/>
</postGoal>
<goal name="setclasspath">
<path id="test.classpath">
<pathelement path="${maven.build.dest}"/>
<pathelement path="target/classes"/>
<pathelement path="target/test-classes"/>
<path refid="maven.dependency.classpath"/>
</path>
<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="test.classpath"/>
<taskdef name="wiki2html" classname="org.codehaus.groovy.ant.Wiki2Markup" classpathref="test.classpath"/>
</goal>
<goal name="asm:dump" prereqs="test:compile"
description="Dumps the ASM instructions to generate the given class using the name property">
<j:if test="${empty(name)}">
<j:set var="name" value="org.codehaus.groovy.classgen.DumpClass"/>
</j:if>
<echo>Dumping class $$name = ${name}</echo>
<java classname="org.objectweb.asm.util.DumpClassVisitor" fork="yes">
<classpath refid="test.classpath"/>
<arg value="${name}"/>
</java>
</goal>
<goal name="groovy:compile" prereqs="java:compile, setclasspath"
description="Compiles the Groovy code">
<copy todir="${basedir}/target/classes">
<fileset dir="${basedir}/src/main">
<include name="**/*.groovy"/>
</fileset>
</copy>
<groovyc destdir="${basedir}/target/classes" srcdir="${basedir}/target/classes" listfiles="true">
<classpath refid="test.classpath"/>
</groovyc>
</goal>
<goal name="groovy:compile-tests" prereqs="groovy:compile, setclasspath"
description="Compiles the Groovy unit test cases">
<!-- lets copy and touch all the groovy files to ensure they all recompile -->
<mkdir dir="${basedir}/target/test-classes"/>
<copy todir="${basedir}/target/test-classes">
<fileset dir="${basedir}/src/test">
<include name="**/*.groovy"/>
<exclude name="**/notworking/*.groovy"/>
<exclude name="**/parser/*.groovy"/>
</fileset>
</copy>
<touch>
<fileset dir="${basedir}/target/test-classes" includes="**/*.groovy"/>
</touch>
<groovyc destdir="${basedir}/target/test-classes" srcdir="${basedir}/target/test-classes" listfiles="true">
<classpath refid="test.classpath"/>
</groovyc>
</goal>
<!--
<goal name="test"
description="Test the application"
prereqs="">
<attainGoal name="groovy:test"/>
</goal>
<goal name="test:test"
description="Test the application"
prereqs="">
<attainGoal name="groovy:test"/>
</goal>
-->
<goal name="groovy:test"
description="Test the application with any Java or Groovy unit tests"
prereqs="test:compile">
<j:if test="${unitTestSourcesPresent == 'true' and context.getVariable('maven.test.skip') != 'true'}">
<taskdef
name="junit"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
/>
<j:set var="testPlugin" value="${pom.getPluginContext('maven-test-plugin')}"/>
<j:set var="reportsDirectory">${testPlugin.findVariable('maven.test.reportsDirectory')}</j:set>
<mkdir dir="${reportsDirectory}"/>
<junit printSummary="yes"
failureProperty="maven.test.failure"
fork="${maven.junit.fork}"
dir="${maven.junit.dir}">
<sysproperty key="basedir" value="${basedir}"/>
<u:tokenize var="listOfProperties" delim=" ">${maven.junit.sysproperties}</u:tokenize>
<j:forEach var="someProperty" items="${listOfProperties}">
<sysproperty key="${someProperty}" value="${context.getVariable(someProperty)}"/>
</j:forEach>
<u:tokenize var="listOfJvmArgs" delim=" ">${maven.junit.jvmargs}</u:tokenize>
<j:forEach var="somejvmarg" items="${listOfJvmArgs}">
<jvmarg value="${somejvmarg}"/>
</j:forEach>
<formatter type="xml"/>
<formatter type="plain" usefile="${maven.junit.usefile}"/>
<classpath>
<path refid="maven.dependency.classpath"/>
<pathelement location="${basedir}/target/classes"/>
<pathelement location="${basedir}/target/test-classes"/>
<pathelement path="${plugin.getDependencyPath('junit')}"/>
</classpath>
<batchtest todir="${reportsDirectory}">
<fileset dir="${basedir}/target/test-classes">
<j:forEach var="pat" items="${pom.build.unitTest.includes}">
<include name="${pat}"/>
</j:forEach>
<j:forEach var="pat" items="${pom.build.unitTest.excludes}">
<exclude name="${pat}"/>
</j:forEach>
<!-- KEEP ALL ABSTRACT TESTS FROM BEING RUN! -->
<exclude name="**/*AbstractTestCase.*"/>
</fileset>
</batchtest>
</junit>
<j:if test="${maven.test.failure}">
<j:set var="ignore__" value="${maven.test.failure.ignore}X"/>
<j:if test="${ignore__ == 'X'}">
<fail message="There were test failures."/>
</j:if>
</j:if>
</j:if>
<j:if test="${!unitTestSourcesPresent}">
<echo>No tests to run.</echo>
</j:if>
</goal>
<goal name="groovy-eclipse:copyjars">
<j:if test="${empty(groovy.eclipse.dir)}">
<j:set var="groovy.eclipse.dir" value="../groovy-eclipse"/>
</j:if>
<copy file="${maven.build.dir}/${maven.final.name}.jar" tofile="${groovy.eclipse.dir}/lib/groovy.jar"/>
<j:forEach var="lib" items="${pom.artifacts}">
<echo>Processing ${lib.name}</echo>
<j:choose>
<j:when test="${lib.name.startsWith('commons-log')}">
<copy file="${lib.path}" tofile="${groovy.eclipse.dir}/lib/commons-logging.jar"/>
</j:when>
<j:when test="${lib.name.startsWith('asm-util')}">
</j:when>
<j:when test="${lib.name.startsWith('asm')}">
<copy file="${lib.path}" tofile="${groovy.eclipse.dir}/lib/asm.jar"/>
</j:when>
</j:choose>
</j:forEach>
</goal>
<goal name="groovy:make-install" prereqs="jar:jar">
<echo>${groovy.install.staging.dest}</echo>
<mkdir dir="${groovy.install.staging.dest}"/>
<mkdir dir="${groovy.install.staging.dest}/lib"/>
<mkdir dir="${groovy.install.staging.dest}/bin"/>
<mkdir dir="${groovy.install.staging.dest}/conf"/>
<j:forEach var="lib" items="${pom.artifacts}">
<copy file="${lib.path}" toDir="${groovy.install.staging.dest}/lib"/>
</j:forEach>
<copy file="${maven.build.dir}/${maven.final.name}.jar" toDir="${groovy.install.staging.dest}/lib"/>
<copy toDir="${groovy.install.staging.dest}/conf">
<fileset dir="${maven.src.dir}/conf">
<include name="*"/>
</fileset>
</copy>
<copy toDir="${groovy.install.staging.dest}/bin">
<fileset dir="${maven.src.dir}/bin">
<include name="*"/>
</fileset>
</copy>
<chmod perm="ugo+x">
<fileset dir="${groovy.install.staging.dest}/bin">
<include name="*"/>
</fileset>
</chmod>
</goal>
</project>