Skip to content

Commit

Permalink
[BUILD][I] Add Cobertura to build.xml for Code Coverage
Browse files Browse the repository at this point in the history
Change-Id: Ifaa691fd3f104a8ac37c1df1e0ef67b159ebff74
Reviewed-on: http://saros-build.imp.fu-berlin.de/gerrit/3146
Tested-by: Jenkins CI
Reviewed-by: Franz Zieris <zieris@inf.fu-berlin.de>
  • Loading branch information
fzieris committed Sep 14, 2016
1 parent e5e837c commit 4a4966b
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
53 changes: 51 additions & 2 deletions de.fu_berlin.inf.dpp.intellij/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@

<property name="saros-i.compiler.args" value="${compiler.args}"/>

<property name="saros-i.build.dir" value="${build.dir}/saros-i/"/>
<property name="saros-i.build.dir" value="${build.dir}/saros-i"/>
<property name="saros-i.output.dir" value="${saros-i.build.dir}/main"/>
<property name="saros-i.testoutput.dir" value="${saros-i.build.dir}/test"/>
<property name="saros-i.artifacts.dir"
Expand Down Expand Up @@ -198,6 +198,13 @@
<property name="saros-i.bundle.path.zip"
value="${saros-i.artifacts.dir}/de.fu_berlin.inf.dpp.intellij.zip"/>

<property name="saros-i.instr.dir" value="${saros-i.build.dir}/instr"/>

<property name="saros-i.cobertura.report.dir"
value="${saros-i.build.dir}/cobertura"/>
<property name="saros-i.cobertura.datafile"
value="${saros-i.cobertura.report.dir}/cobertura.ser"/>


<!-- =================================
Libraries
Expand Down Expand Up @@ -240,6 +247,19 @@
classpathref="javac2.classpath"/>
</target>

<!-- - - - - - - - - - - - - - - - - -
Cobertura setup
- - - - - - - - - - - - - - - - - -->

<path id="cobertura.classpath">
<fileset dir="${cobertura.dir}">
<include name="cobertura.jar"/>
<include name="lib/**/*.jar"/>
</fileset>
</path>

<taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>


<!-- =================================
Own macros
Expand Down Expand Up @@ -384,25 +404,50 @@

<target name="clean.saros-i" description="cleanup saros-i">
<delete dir="${saros-i.build.dir}" failonerror="false"/>
<delete dir="${saros-i.instr.dir}" failonerror="false"/>
</target>


<!-- =================================
Targets: Saros IntelliJ plugin, Test Execution
================================= -->

<target name="test" depends="compile.saros-i.tests"
<target name="instrument">
<mkdir dir="${saros-i.instr.dir}"/>

<cobertura-instrument todir="${saros-i.instr.dir}"
datafile="${saros-i.cobertura.datafile}">

<fileset dir="${saros-i.output.dir}">
<include name="**/*.class"/>
</fileset>

<excludeClasses regex=".*\.stf\..*"/>

<auxClasspath>
<path refid="saros-i.test.classpath"/>
</auxClasspath>
</cobertura-instrument>
</target>

<target name="test" depends="compile.saros-i.tests, instrument"
description="run saros-i unit tests">

<mkdir dir="${saros-i.junit.report.dir}"/>
<junit printsummary="yes" fork="yes" forkmode="once"
haltonfailure="yes" jvm="${jdk.bin}/java">

<sysproperty key="net.sourceforge.cobertura.datafile"
value="${saros-i.cobertura.datafile}"/>

<classpath location="${saros-i.instr.dir}"/>
<classpath>
<path refid="saros-i.test.classpath"/>
<pathelement path="${saros-i.testoutput.dir}"/>
</classpath>

<classpath refid="cobertura.classpath"/>

<formatter type="xml"/>

<batchtest todir="${saros-i.junit.report.dir}">
Expand All @@ -412,6 +457,10 @@
</fileset>
</batchtest>
</junit>

<cobertura-report format="xml" datafile="${saros-i.cobertura.datafile}"
destdir="${saros-i.cobertura.report.dir}"
srcdir="${saros-i.basedir}/src"/>
</target>


Expand Down
1 change: 1 addition & 0 deletions de.fu_berlin.inf.dpp.intellij/sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ sonar.exclusions = **/Messages.java
# Tests and test results
sonar.tests = test/junit
sonar.junit.reportsPath = bin/saros-i/junit
sonar.cobertura.reportPath = bin/saros-i/cobertura/coverage.xml

0 comments on commit 4a4966b

Please sign in to comment.