blob: 0c8a36eb99a06ad79d143e9d866fcb593f0ae552 [file] [log] [blame]
<project default="default" xmlns:j="jelly:core" xmlns:u="jelly:util" >
<goal name="default" prereqs="clean, groovy:make-install"/>
<!-- DC currently has trouble creating the wiki pages
<goal name="dc" prereqs="clean, test, site:deploy"/>
and this seems to run the unit test cases twice for some wierd reason!
<goal name="dc" prereqs="clean, test, site"/>
-->
<goal name="dc" prereqs="clean, jar:deploy-snapshot"/>
<preGoal name="site:deploy">
<attainGoal name="javadoc"/>
</preGoal>
<postGoal name="dist:prepare-src-filesystem">
<!-- lets zap the build.xml -->
<delete file="${maven.dist.src.assembly.dir}/build.xml"/>
</postGoal>
<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" prereqs="clean, groovy:disable-unittests, site, dist:deploy-bin, dist:deploy-src, jar:deploy"
description="Performs a release of the source, binary and jar distros">
</goal>
<goal name="groovy:disable-unittests" description="Disables the running of the unit test cases">
<!-- we've run the tests by now once already, lets avoid it again -->
<j:set var="maven.test.skip" value="true"/>
</goal>
<preGoal name="groovy:release">
<!-- we've run the tests by now once already, lets avoid it again -->
<j:set var="maven.test.skip" value="true"/>
</preGoal>
<goal name="groovy:test-wiki" description="Generates the test cases for the wiki and runs the tests">
<attainGoal name="clean"/>
<attainGoal name="groovy:compile"/>
<j:set var="testcase" value="org.codehaus.groovy.wiki.RunWikiTest"/>
<attainGoal name="test:single"/>
</goal>
<goal name="groovy:test-single" prereqs="groovy:compile" description="Runs a named groovy test case using the 'test' property">
<java classname="groovy.util.GroovyTestSuite" fork="yes">
<classpath refid="test.classpath"/>
<sysproperty key="test" value="${test}"/>
</java>
</goal>
<goal name="groovy:test-quick" prereqs="clean" description="Tries running all the unit test cases in the same JVM">
<attainGoal name="clean"/>
<attainGoal name="groovy:compile"/>
<j:set var="testcase" value="org.codehaus.groovy.tools.FindAllTestsSuite"/>
<j:set var="maven.junit.usefile" value="false"/>
<attainGoal name="test:single"/>
</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">
<attainGoal name="groovy:xdoc-stuff"/>
</preGoal>
<goal name="groovy:xdoc-stuff" prereqs="java:compile, setclasspath, groovy:make-new-javadoc">
<mkdir dir="${maven.html2xdoc.dir}"/>
<!--
<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}"/>
<!-- lets generate the HTML docs -->
<attainGoal name="groovy:make-new-javadoc"/>
<attainGoal name="html2xdoc"/>
<attainGoal name="faq"/>
</goal>
<goal name="groovy:make-new-javadoc" prereqs="java:compile"
description="Generates the HTML of the new JavaDoc added to the JDK">
<mkdir dir="${maven.html2xdoc.dir}"/>
<java classname="org.codehaus.groovy.tools.DocGenerator" fork="yes">
<classpath refid="test.classpath"/>
</java>
</goal>
<postGoal name="test:compile">
<attainGoal name="setclasspath"/>
<attainGoal name="groovy:compile-tests"/>
${context.setVariable('java.awt.headless', true)}
</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.wiki.Wiki2Markup" classpathref="test.classpath"/>
<taskdef name="wiki2testcase" classname="org.codehaus.groovy.wiki.Wiki2TestCase" 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">
<!-- lets create the test cases from the wiki documentation -->
<mkdir dir="${basedir}/target/test-classes/wiki"/>
<wiki2testcase srcdir="${basedir}/xdocs" destdir="${basedir}/target/test-classes/wiki"/>
<copy todir="${basedir}/target/classes">
<fileset dir="${basedir}/src/main">
<include name="**/*.groovy"/>
<exclude name="CVS/*"/>
</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"/>
<exclude name="CVS/*"/>
</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}"/>
<!-- use headless for AWT stuff -->
<u:replace var="headless" oldChar="_" newChar=".">java_awt_headless</u:replace>
<echo>Setting property ${headless} to true</echo>
<sysproperty key="${headless}" value="true"/>
<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>