Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 191 lines (170 sloc) 5.947 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
<project name="junit" default="dist" basedir=".">
<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-SNAPSHOT-20100512-0041" />
<property name="version-status" value="" />
<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="depjar" value="junit-dep-${version}.jar" />
<property name="srcjar" value="junit-${version}-src.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}" />

<!-- What is this good for? It will clear out earlier dist builds and the eclipse bin folder. Remove?
<delete>
<fileset dir="${basedir}" includes="**/*.class" />
</delete>
-->
</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="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>

<target name="dist" depends="populate-dist">
<java classname="org.junit.runner.JUnitCore" fork="yes" failonerror="true">
<arg value="org.junit.tests.AllTests"/>
<classpath>
<pathelement location="${dist}" />
<pathelement location="${dist}/${binjar}" />
</classpath>
</java>
</target>

<!-- TODO: DUP above -->

<target name="profile" depends="populate-dist">
<java classname="org.junit.runner.JUnitCore" fork="yes" failonerror="true">
<jvmarg value="-agentlib:hprof=cpu=samples"/>
<arg value="org.junit.tests.AllTests"/>
<classpath>
<pathelement location="${dist}" />
<pathelement location="${dist}/${binjar}" />
</classpath>
</java>
</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>
</project>
Something went wrong with that request. Please try again.