Mercurial > public > develkit
changeset 28:ad0a75e20f7b
TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
author | smith@nwoca.org |
---|---|
date | Mon, 11 Apr 2011 16:32:20 -0400 |
parents | ea29594bb799 |
children | bedf62f3916d |
files | bootstrap.xml sonar-ant.xml ssdt-common-build.xml |
diffstat | 3 files changed, 41 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/bootstrap.xml Sun Apr 10 21:42:19 2011 -0400 +++ b/bootstrap.xml Mon Apr 11 16:32:20 2011 -0400 @@ -5,7 +5,7 @@ <property file="${ssdt.devel.kit}/private.properties"/> <property name="user.home.ant.lib" value="${user.home}/.ant/lib"/> <property name="ssdt.devel.kit.src" value="http://hg.ssdt-ohio.org/browse/public/develkit"/> - + <mkdir dir="${ssdt.devel.kit}"/> <mkdir dir="${user.home.ant.lib}"/> @@ -66,4 +66,17 @@ <ssdt:import-ant file="antcontrib-ant.xml"/> <ssdt:import-ant file="ssdt-common-build.xml"/> <ssdt:import-ant file="netbeans-ant.xml"/> + + <macrodef name="add-dependency" + description="Dynamically adds a new dependencty into an existing target." + uri="http://www.ssdt-ohio.org/ant/common"> + <attribute name="target" description="Target to add dendency for"/> + <attribute name="depends" description="new dependancy for target"/> + <sequential> + <groovy> + project.targets['@{target}'].addDependency('@{depends}') + </groovy> + </sequential> + </macrodef> + </project>
--- a/sonar-ant.xml Sun Apr 10 21:42:19 2011 -0400 +++ b/sonar-ant.xml Mon Apr 11 16:32:20 2011 -0400 @@ -12,6 +12,18 @@ src="${ssdt.sonar.jar.src}"/> <ssdt:import-ant file="jacoco-ant.xml"/> + <ssdt:add-dependency target="init" depends="-sonar-init"/> + + <target name="-sonar-init"> + <echo message="Sonar: Active"/> + <echoproperties prefix="ant"/> + <if> + <contains string="${ant.project.invoked-targets}" substring="sonar"/> + <then> <property name="ignore.failing.tests" value="true"/> </then> + </if> + <property name="sonar.active" value="true"/> + </target> + <target name="-check-sonar"> <property file="${ssdt.devel.kit}/sonar.properties"/> <property name="sonar.host.url" value="http://ssdt-web-10.nwoca.org:9000" /> @@ -20,6 +32,7 @@ </target> <target name="sonar" depends="project.init,-check-sonar,ivy-info,coverage.xml" if="sonar.enabled"> + <fail unless="sonar.active" message="Sonar has not been initialized"/> <sonar:sonar workDir="${build.dir}/sonar" key="${ivy.project.organisation}:${ivy.project.module}" @@ -38,8 +51,9 @@ </tests> <binaries> <path location="${build.dir}/classes" /> - </binaries> - </sonar:sonar> + </binaries> + </sonar:sonar> + <fail if="tests.failed">Some tests failed; see details above. (sonar)</fail> </target> </project>
--- a/ssdt-common-build.xml Sun Apr 10 21:42:19 2011 -0400 +++ b/ssdt-common-build.xml Mon Apr 11 16:32:20 2011 -0400 @@ -23,19 +23,17 @@ <cvs command="up -d -P"/> </target> - <target name="-project.init.groovy.task" depends="init"> - <if> - <available classpath="${run.test.classpath}" classname="org.codehaus.groovy.ant.Groovy"/> - <then> - <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${run.test.classpath}"/> - </then> - <else> - <property name="ssdt.groovy.jar.src" value="http://ivy.ssdt.nwoca.org/repository/groovy/groovy-all.jar"/> - <ssdt:fetch dest="${ssdt.devel.kit}/groovy-all.jar" src="${ssdt.groovy.jar.src}"/> - <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${ssdt.devel.kit}/groovy-all.jar"/> - </else> - </if> - </target> + <if> + <available classpath="${run.test.classpath}" classname="org.codehaus.groovy.ant.Groovy"/> + <then> + <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${run.test.classpath}"/> + </then> + <else> + <property name="ssdt.groovy.jar.src" value="http://ivy.ssdt.nwoca.org/repository/groovy/groovy-all.jar"/> + <ssdt:fetch dest="${ssdt.devel.kit}/groovy-all.jar" src="${ssdt.groovy.jar.src}"/> + <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${ssdt.devel.kit}/groovy-all.jar"/> + </else> + </if> <target name="project.init" depends="init"> <property file="build-number.txt" description="Bamboo build number"/>