Mercurial > public > develkit
changeset 26:639bec4999f2
TL-34: Scripts for sonar integration
author | smith@nwoca.org |
---|---|
date | Fri, 08 Apr 2011 17:37:19 -0400 |
parents | e6fd2f1eba13 |
children | ea29594bb799 |
files | clover-ant.xml ivy-ant.xml sonar-ant.xml |
diffstat | 3 files changed, 51 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/clover-ant.xml Thu Apr 07 19:14:15 2011 -0400 +++ b/clover-ant.xml Fri Apr 08 17:37:19 2011 -0400 @@ -6,8 +6,8 @@ <description>Clover Ant tasks</description> - <target name="-check.clover"> - <property name="clover.jar.file" value="${user.home.ant.lib}/clover.jar}"/> + <target name="-check.clover" depends="init"> + <property name="clover.jar.file" value="${user.home.ant.lib}/clover.jar"/> <property name="ssdt.clover.jar.src" value="http://ivy.ssdt.nwoca.org/repository/clover/clover.jar"/> <property name="clover.dest" value="${build.dir}/clover"/> @@ -21,21 +21,27 @@ <available file="${clover.license}"/> </and> </condition> + <if> + <isset property="clover.installed"/> + <then><taskdef resource="cloverlib.xml"/></then> + </if> </target> - <target name="with.coverage" depends="init,-check.clover" if="clover.installed"> - <taskdef resource="cloverlib.xml"/> - + <target name="with.coverage" depends="-check.clover" if="clover.installed"> + <property name="coverage.run.with.clover" value="true"/> <clover-env/> - <clover-setup recordTestResults="false"/> <clover-clean/> + <clover-setup> + <fileset dir="${src.dir}"/> + </clover-setup> <mkdir dir="${build.dir}/.clover"/> <mkdir dir="${build.dir}/clover"/> </target> - - <target name="coverage.xml" description="Generates an XML report to ${clover.dest}." if="coverage.run.with.clover"> + <target name="coverage.xml" depends="-check.clover" + description="Generates an XML report to ${clover.dest}." + if="coverage.run.with.clover"> <clover-report> <current outfile="${clover.dest}/clover.xml" title="${ivy.project.module}" span="${clover.span}"> <format type="xml"/> @@ -47,6 +53,18 @@ </clover-report> </target> - + <target name="coverage.html" depends="-check.clover" + description="Generates an HTML report to ${clover.dest}." + if="coverage.run.with.clover"> + <clover-report> + <current outfile="${clover.dest}" title="${ivy.project.module}" span="${clover.span}"> + <format type="html"/> + <testresults dir="build/test/results" includes="TEST-*.xml"/> + <sourcepath> + <pathelement path="${src.dir}"/> + </sourcepath> + </current> + </clover-report> + </target> </project>
--- a/ivy-ant.xml Thu Apr 07 19:14:15 2011 -0400 +++ b/ivy-ant.xml Fri Apr 08 17:37:19 2011 -0400 @@ -147,6 +147,23 @@ <property name="run.test.classpath" value="${old.run.test.classpath}${path.separator}${ivy.run.test.classpath}"/> </else> </if> + <if> + <isset property="coverage.run.with.cobertura"/> + <then> + <property name="precoverage.run.test.classpath" value="${run.test.classpath}"/> + <var name="run.test.classpath" unset="true"/> + <property name="run.test.classpath" value="${cobertura.instrumented.classes}${path.separator}${precoverage.run.test.classpath}${path.separator}${cobertura.classpath.path}"/> + </then> + </if> + <if> + <isset property="coverage.run.with.clover"/> + <then> + <property name="preclover.run.test.classpath" value="${run.test.classpath}"/> + <var name="run.test.classpath" unset="true"/> + <property name="run.test.classpath" value="${preclover.run.test.classpath}${path.separator}${clover.jar.file}"/> + </then> + </if> + <echo level="debug" message="$${run.test.classpath} : ${run.test.classpath}"/> <ivy:cachepath pathid="ivy.debug.classpath.id" conf="compile,runtime" type="jar"/>
--- a/sonar-ant.xml Thu Apr 07 19:14:15 2011 -0400 +++ b/sonar-ant.xml Fri Apr 08 17:37:19 2011 -0400 @@ -14,10 +14,14 @@ <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml"/> - <property name="sonar.host.url" value="http://localhost:9000" /> + <property name="sonar.host.url" value="http://ssdt-web-10.nwoca.org:9000" /> <property name="sonar.language" value="grvy"/> - <target name="sonar" depends="project.init,ivy-info,coverage.xml"> + <target name="-check-sonar"> + <property file="${ssdt.devel.kit}/sonar.properties"/> + </target> + + <target name="sonar" depends="project.init,-check-sonar,ivy-info,coverage.xml" if="sonar.enabled"> <property name="clover.dest" value="${build.dir}/clover"/> <property name="coverage.report.path" location="${clover.dest}/clover.xml"/> <sonar:sonar @@ -27,6 +31,7 @@ <sources> <path location="${src.dir}" /> </sources> + <property key="sonar.core.codeCoveragePlugin" value="clover"/> <property key="sonar.projectName" value="${ivy.project.module}"/> <property key="sonar.language" value="${sonar.language}" /> <property key="sonar.dynamicAnalysis" value="reuseReports" />