rendered paste body<project name="nde17.junit.emma" default="emma">
<!--
HACK:
plugins.dir must be set to the value of ${osgi.syspath}. ${osgi.syspath}
can't be used directly, JUnit doesn't like it that way.
-->
<property name="plugins.dir" location="P:/Programme/eclipse-3.1.2/plugins" />
<property name="base.dir" location="." />
<property name="metamodel.base.dir" location="${base.dir}/../meta-model" />
<property name="src.dir" location="${base.dir}/src" />
<property name="tests.dir" location="${base.dir}/tests" />
<property name="emma.dir" location="${base.dir}/emma" />
<property name="instr.dir" location="${emma.dir}/instr" />
<property name="junit.dir" location="${emma.dir}/junit" />
<property name="report.dir" location="${emma.dir}/report" />
<path id="run.classpath">
<pathelement location="${plugins.dir}/org.eclipse.gef_3.1.1.jar" />
<pathelement location="${plugins.dir}/org.eclipse.draw2d_3.1.1.jar" />
<pathelement location="${plugins.dir}/org.eclipse.swt_3.1.0.jar" />
<pathelement location="${plugins.dir}/org.eclipse.swt.win32.win32.x86_3.1.2.jar" />
<pathelement location="${plugins.dir}/org.eclipse.core.runtime_3.1.2.jar" />
<pathelement location="${plugins.dir}/org.eclipse.osgi_3.1.2.jar"/>
<pathelement location="${plugins.dir}/org.eclipse.core.resources_3.1.2.jar" />
<pathelement location="${plugins.dir}/org.eclipse.ui_3.1.2.jar" />
<pathelement location="${plugins.dir}/org.eclipse.jface_3.1.1.jar"/>
<pathelement location="${plugins.dir}/org.eclipse.core.commands_3.1.0.jar" />
<pathelement location="${plugins.dir}/org.eclipse.ui.workbench_3.1.2.jar" />
<pathelement location="${plugins.dir}/org.eclipse.ui.views_3.1.1.jar" />
<pathelement location="${plugins.dir}/org.eclipse.ui.ide_3.1.1.jar" />
<pathelement location="${plugins.dir}/org.eclipse.ui.externaltools_3.1.1.jar" />
<pathelement location="${plugins.dir}/org.eclipse.jdt.ui_3.1.2.jar" />
<pathelement location="${plugins.dir}/org.eclipse.emf.ecore_2.1.0.jar" />
<pathelement location="${plugins.dir}/org.eclipse.emf.common_2.1.0.jar" />
<pathelement location="${plugins.dir}/org.eclipse.emf.ecore.xmi_2.1.0.jar" />
<pathelement location="${metamodel.base.dir}/bin" />
</path>
<target name="emma" >
<!-- Verify that Emma is installed. -->
<available file="${ant.home}/lib/emma.jar" property="emma.available" />
<fail unless="emma.available" message="Error: emma.jar not found, indicating Emma is not installed." />
<!-- Define the path and taskdef containing the emma binaries. -->
<property name="emma.lib.dir" value="${ant.home}/lib" />
<path id="emma.lib.dir" >
<pathelement location="${emma.lib.dir}/emma.jar" />
<pathelement location="${emma.lib.dir}/emma_ant.jar" />
</path>
<taskdef resource="emma_ant.properties" classpathref="emma.lib.dir" />
<!-- Instrument the .class files. -->
<mkdir dir="${emma.dir}" />
<delete dir="${instr.dir}" />
<mkdir dir="${instr.dir}" />
<copy todir="${instr.dir}">
<fileset dir="${base.dir}/bin"
includes="**/*.class"/>
</copy>
<emma enabled="true" >
<instr instrpath="${instr.dir}/de/upb/swtpra06/nde17/commands"
destdir="${instr.dir}/de/upb/swtpra06/nde17/commands"
metadatafile="${emma.dir}/metadata.emma"
merge="true" mode="overwrite" >
<filter excludes="*Test, *Tests" />
</instr>
</emma>
<!-- Run JUnit with the instrumented class files. -->
<mkdir dir="${junit.dir}" />
<junit printsummary="withOutAndErr"
fork="yes"
haltonfailure="yes" >
<classpath path="${instr.dir};${java.class.path};">
<path refid="emma.lib.dir" />
<path refid="run.classpath" />
</classpath>
<sysproperty key="emma.coverage.out.file" value="${emma.dir}/coverage.emma" />
<sysproperty key="emma.coverage.out.merge" value="true" />
<formatter type="xml" />
<batchtest todir="${junit.dir}">
<fileset dir="${tests.dir}">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
<!-- Generate Emma reports. -->
<delete dir="${report.dir}" />
<mkdir dir="${report.dir}" />
<emma enabled="true" >
<report sourcepath="${src.dir}"
sort="+name"
metrics="method:70,block:80,line:80,class:100">
<fileset dir="${emma.dir}" >
<include name="*.emma" />
</fileset>
<html outfile="${report.dir}/coverage.html"
depth="method"
columns="name,class,method,block,line" />
</report>
</emma>
<!-- Now delete the instrumented .class files. -->
<!-- <delete dir="${instr.dir}" /> -->
</target>
</project>