Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

280 lines (245 sloc) 9.22 kb
<project name="junit" default="dist" basedir="."
xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<tstamp />
<property file="${user.home}/.junit.properties" />
<property name="src" value="src/main/java" />
<property name="target" location="target" />
<property name="bin" location="${target}/main" />
<property name="version-base" value="4.9" />
<property name="version-status" value="b2" />
<property name="version" value="${version-base}${version-status}" />
<property name="dist" value="junit${version}" />
<property name="versionfile" value="${src}/junit/runner/Version.java" />
<property name="zipfile" value="${dist}/${dist}.zip" />
<property name="testsrc" location="src/test/java" />
<property name="testbin" location="${target}/test/java" />
<property name="unjarred"
value="**/*.jar, ${testfiles}, doc/**, README.html, .classpath, .project, cpl-v10.html" />
<property name="binjar" value="junit-${version}.jar" />
<property name="srcjar" value="junit-${version}-src.jar" />
<property name="docjar" value="junit-${version}-javadoc.jar" />
<property name="depjar" value="junit-dep-${version}.jar" />
<property name="depsrcjar" value="junit-dep-${version}-src.jar" />
<property name="depdocjar" value="junit-dep-${version}-javadoc.jar" />
<property name="javadocdir" location="${dist}/javadoc" />
<property name="javadoczip" location="${dist}-javadoc.zip" />
<property name="hamcrestlib" location="lib/hamcrest-core-1.1.jar" />
<property name="hamcrestsrc" location="${dist}/temp.hamcrest.source" />
<target name="init">
<tstamp/>
</target>
<target name="versiontag" depends="init">
<filter token="version" value="${version}" />
<copy
file="${versionfile}.template"
tofile="${versionfile}"
filtering="on"
overwrite="true"
/>
</target>
<target name="clean">
<!-- If two builds are made within a minute -->
<delete dir="${dist}" quiet="true" />
<!-- Delete all previous temporary build artifacts -->
<delete dir="${target}" quiet="true" />
<delete file="${zipfile}" quiet="true"/>
<delete file="${javadoczip}" />
</target>
<macrodef name="junit_compilation">
<attribute name="srcdir"/>
<attribute name="destdir"/>
<attribute name="classpath"/>
<sequential>
<mkdir dir="@{destdir}"/>
<javac
srcdir="@{srcdir}"
destdir="@{destdir}"
debug="on"
classpath="@{classpath}"
includeantruntime="false"
target="1.5"
>
<compilerarg value="-Xlint:unchecked" />
</javac>
</sequential>
</macrodef>
<target name="build" depends="versiontag">
<junit_compilation srcdir="${src}" destdir="${bin}" classpath="${hamcrestlib}"/>
<unjar src="${hamcrestlib}" dest="${bin}" />
<junit_compilation srcdir="${testsrc}" destdir="${testbin}" classpath="${hamcrestlib};${bin}"/>
</target>
<target name="jars" depends="build">
<mkdir dir="${dist}" />
<jar
jarfile="${dist}/${srcjar}"
basedir="${src}"
excludes="${unjarred}, **/*.class"
/>
<jar
jarfile="${dist}/${binjar}"
basedir="${bin}"
excludes="${unjarred}, **/*.java, build.xml"
/>
<jar
jarfile="${dist}/${depjar}"
basedir="${bin}"
excludes="${unjarred}, org/hamcrest/**, **/*.java, build.xml"
/>
</target>
<target name="all.maven.jars" depends="jars,javadoc">
<mkdir dir="${dist}" />
<jar
jarfile="${dist}/${docjar}"
basedir="${javadocdir}"
excludes="${unjarred}"
/>
<jar
jarfile="${dist}/${depsrcjar}"
basedir="${src}"
excludes="${unjarred}, **/*.class"
/>
<jar
jarfile="${dist}/${depdocjar}"
basedir="${javadocdir}"
excludes="${unjarred}, org/hamcrest/**"
/>
</target>
<target name="samples-and-tests">
<copy todir="${dist}">
<fileset dir="${testbin}" />
<fileset dir="${testsrc}" />
</copy>
</target>
<target name="unjar.hamcrest">
<unjar src="${hamcrestlib}" dest="${hamcrestsrc}" />
</target>
<target name="release-notes">
<property name="basename" value="doc/ReleaseNotes${version-base}" />
<exec executable="build/Markdown.pl">
<arg file="${basename}.txt"/>
<redirector output="${basename}.html" />
</exec>
</target>
<target name="javadoc" depends="unjar.hamcrest">
<javadoc destdir="${javadocdir}"
author="false"
version="false"
use="false"
windowtitle="JUnit API"
stylesheetfile="stylesheet.css"
>
<excludepackage name="junit.*" />
<excludepackage name="org.junit.internal.*" />
<excludepackage name="org.junit.experimental.theories.internal.*" />
<sourcepath location="${src}" />
<sourcepath location="${hamcrestsrc}" />
<link href="http://java.sun.com/javase/6/docs/api/" />
</javadoc>
</target>
<target name="javadoczip">
<delete file="${javadoczip}" />
<antcall target="javadoc" />
<zip basedir="${javadocdir}" file="${javadoczip}" />
</target>
<target name="populate-dist"
depends="clean, build, jars, samples-and-tests, javadoc, release-notes"
>
<copy todir="${dist}/doc">
<fileset dir="doc"/>
</copy>
<copy file="README.html" tofile="${dist}/README.html" />
<copy file="cpl-v10.html" tofile="${dist}/cpl-v10.html" />
<copy file="build.xml" tofile="${dist}/build.xml" />
</target>
<macrodef name="run-tests">
<element name="extra-args" implicit="yes" />
<sequential>
<java classname="org.junit.runner.JUnitCore" fork="yes" failonerror="true">
<extra-args />
<arg value="org.junit.tests.AllTests"/>
<classpath>
<pathelement location="${dist}" />
<pathelement location="${dist}/${binjar}" />
</classpath>
</java>
</sequential>
</macrodef>
<target name="dist" depends="populate-dist">
<run-tests>
<jvmarg value="-Dignore.this=ignored" />
</run-tests>
</target>
<target name="profile" depends="populate-dist">
<run-tests>
<jvmarg value="-agentlib:hprof=cpu=samples"/>
</run-tests>
</target>
<target name="zip" depends="dist">
<zip zipfile="${zipfile}" basedir="." includes="${dist}/**" />
</target>
<target name="upload.to.sourceforge" depends="zip">
<ftp server="upload.sourceforge.net"
userid="anonymous"
password="saff@mit.edu"
remotedir="incoming"
>
<fileset dir="${dist}" includes="*.jar" />
<fileset file="${zipfile}" />
</ftp>
<echo message="To upload docs, use build/upload_docs.sh" />
</target>
<!-- to do automatic build upload, you need the maven ant tasks jar. -->
<!-- therefore, you must run ant as ant -lib build/lib stage.maven -->
<macrodef name="stage.maven.jar">
<attribute name="jar" />
<attribute name="pom" />
<element name="artifact.args" implicit="true" optional="true" />
<sequential>
<property name="maven-repository-url"
value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<property name="maven-repository-id" value="sonatype-nexus-staging" />
<echo message="Staging to maven: @{jar}" />
<artifact:mvn failonerror="true">
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=@{pom}" />
<arg value="-Dfile=@{jar}" />
<artifact.args />
<arg value="-Pgpg" />
</artifact:mvn>
</sequential>
</macrodef>
<macrodef name="stage.maven.artifactId">
<attribute name="artifactId" />
<sequential>
<property name="m.prefix" value="${dist}/@{artifactId}-${version}" />
<property name="m.jar" value="${m.prefix}.jar" />
<property name="m.sources.jar" value="${m.prefix}-src.jar" />
<property name="m.javadoc.jar" value="${m.prefix}-javadoc.jar" />
<property name="m.pom" value="${dist}/pom-@{artifactId}.xml" />
<filter token="version" value="${version}" />
<filter token="artifactId" value="@{artifactId}" />
<copy
file="pom-template.xml"
tofile="${m.pom}"
filtering="on"
overwrite="true"
/>
<stage.maven.jar jar="${m.jar}" pom="${m.pom}" />
<stage.maven.jar jar="${m.sources.jar}" pom="${m.pom}" >
<arg value="-Dclassifier=sources" />
</stage.maven.jar>
<stage.maven.jar jar="${m.javadoc.jar}" pom="${m.pom}" >
<arg value="-Dclassifier=javadoc" />
</stage.maven.jar>
</sequential>
</macrodef>
<target name="stage.maven" depends="all.maven.jars">
<stage.maven.artifactId artifactId="junit" />
<stage.maven.artifactId artifactId="junit-dep" />
</target>
<target name="print.version">
<echo message="${version}" />
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.