| <project default="default" xmlns:j="jelly:core" xmlns:u="jelly:util" xmlns:maven="jelly:maven"> |
| |
| <goal name="default" prereqs="clean, groovy:make-install"/> |
| |
| <goal name="dc" prereqs="clean"> |
| <attainGoal name="jar:deploy-snapshot"/> |
| |
| <j:set var="maven.test.skip" value="true"/> |
| |
| <attainGoal name="site:deploy"/> |
| </goal> |
| |
| <goal name="modules" description="Builds related modules"> |
| <maven:reactor |
| basedir="${basedir}/../modules" |
| includes="xmlrpc/project.xml" |
| banner="Executing build:" |
| ignoreFailures="false" |
| postProcessing="true" |
| goals="jar" |
| /> |
| </goal> |
| <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, jar:install, release, 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-full-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="**/*"/> |
| <exclude name="**/*.groovy"/> |
| </fileset> |
| </copy> |
| <chmod perm="ugo+x"> |
| <fileset dir="${maven.dist.bin.assembly.dir}/bin"> |
| <include name="*"/> |
| <include name="*.*"/> |
| </fileset> |
| </chmod> |
| </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"/> |
| <j:if test="${unitTestSourcesPresent == 'true' and context.getVariable('maven.test.skip') != 'true'}"> |
| <attainGoal name="groovy:compile-tests"/> |
| </j:if> |
| ${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="**/script/AtomTestScript.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> |
| |
| <!-- re compile java, so that UberTests are now built --> |
| <javac srcdir="${basedir}/src/test" |
| destdir="${basedir}/target/test-classes" |
| classpathref="test.classpath"> |
| <include name="**/Uber*.java" /> |
| </javac> |
| |
| </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.groovypath}" tofile="${groovy.eclipse.dir}/lib/asm.jar"/> |
| </j:when> |
| </j:choose> |
| </j:forEach> |
| |
| </goal> |
| |
| <preGoal name="jar:jar"> |
| <attainGoal name="groovy:compile"/> |
| </preGoal> |
| |
| <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="*"/> |
| <include name="*.*"/> |
| </fileset> |
| </chmod> |
| <attainGoal name="groovy:embeddable-jar"/> |
| </goal> |
| |
| <goal name="groovy:make-full-install" prereqs="groovy:make-install"> |
| <!-- lets copy xmlrpc into the release --> |
| <attainGoal name="modules"/> |
| <!-- |
| <echo>Copying the xmlrpc jar into the install directory ${groovy.install.staging.dest}/lib</echo> |
| --> |
| |
| <copy toDir="${groovy.install.staging.dest}/lib"> |
| <fileset dir="../modules/xmlrpc/target"> |
| <include name="groovy*.jar"/> |
| </fileset> |
| </copy> |
| </goal> |
| |
| <goal name="groovy:embeddable-jar"> |
| <mkdir dir="${groovy.embeddable.working.dir}"/> |
| <unzip dest="${groovy.embeddable.working.dir}"> |
| <fileset dir="${groovy.install.staging.dest}/lib"> |
| <include name="asm*.jar"/> |
| <exclude name="asm-attr*.jar"/> |
| <exclude name="asm-util*.jar"/> |
| <exclude name="asm-analysis*.jar"/> |
| <include name="groovy*.jar"/> |
| </fileset> |
| </unzip> |
| <copy toDir="${groovy.embeddable.working.dir}/META-INF"> |
| <fileset dir="${basedir}"> |
| <include name="ASM-LICENSE.txt"/> |
| </fileset> |
| </copy> |
| <mkdir dir="${groovy.install.staging.dest}/embeddable"/> |
| <jar jarfile="${groovy.install.staging.dest}/embeddable/groovy-all-${pom.currentVersion}.jar" |
| manifest="${groovy.embeddable.working.dir}/META-INF/MANIFEST.MF"> |
| <fileset dir="${groovy.embeddable.working.dir}"/> |
| </jar> |
| <!-- <delete dir="${groovy.embeddable.working.dir}"/>--> |
| </goal> |
| |
| <goal name="groovy:exe" prereqs="rebuild"> |
| <echo>Building a Groovy executable</echo> |
| <mkdir dir="${maven.build.dir}/native/classes"/> |
| <unzip src="${maven.build.dir}/${maven.final.name}.jar" dest="${maven.build.dir}/native/classes" |
| /> |
| |
| <unzip src="${groovy.install.staging.dest}/lib/asm-1.5.2.jar" dest="${maven.build.dir}/native/classes"/> |
| <unzip src="${groovy.install.staging.dest}/lib/asm-util-1.5.2.jar" dest="${maven.build.dir}/native/classes"/> |
| <unzip src="${groovy.install.staging.dest}/lib/asm-attrs-1.5.2.jar" dest="${maven.build.dir}/native/classes"/> |
| <unzip src="${groovy.install.staging.dest}/lib/asm-analysis-1.5.2.jar" dest="${maven.build.dir}/native/classes"/> |
| |
| <unzip src="${groovy.install.staging.dest}/lib/commons-cli-1.0.jar" dest="${maven.build.dir}/native/classes"/> |
| <exec executable="gcc"> |
| <arg line="-g -o ${maven.build.dir}/native/base ${maven.src.dir}/native/base.c"/> |
| </exec> |
| <jar manifest="${maven.src.dir}/native/manifest-groovy" destfile="${maven.build.dir}/native/groovy.jar" basedir="${maven.build.dir}/native/classes"/> |
| <jar manifest="${maven.src.dir}/native/manifest-groovyc" destfile="${maven.build.dir}/native/groovyc.jar" basedir="${maven.build.dir}/native/classes"/> |
| <concat destfile="${maven.build.dir}/native/groovy"> |
| <filelist dir="${maven.build.dir}/native" files="base,groovy.jar"/> |
| </concat> |
| <concat destfile="${maven.build.dir}/native/groovyc"> |
| <filelist dir="${maven.build.dir}/native" files="base,groovyc.jar"/> |
| </concat> |
| <chmod file="${maven.build.dir}/native/groovy" perm="ugo+rx"/> |
| </goal> |
| |
| </project> |