annotate sonar-ant.xml @ 31:0cbc383e341b

TL-34: Handle case of missing coverage data file under sonar
author smith@nwoca.org
date Tue, 12 Apr 2011 16:49:39 -0400
parents 22f63ae66fed
children f8b0dde24622
rev   line source
24
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
1 <?xml version="1.0" encoding="UTF-8"?>
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
2 <project name="sonar-project-tasks" default="" basedir="."
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
3 xmlns:ivy="antlib:fr.jayasoft.ivy.ant"
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
4 xmlns:sonar="antlib:org.sonar.ant"
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
5 xmlns:ssdt="http://www.ssdt-ohio.org/ant/common">
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
6
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
7 <description>Sonar Ant tasks</description>
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
8
25
e6fd2f1eba13 add sonar with clover coverage
smith@nwoca.org
parents: 24
diff changeset
9 <property name="ssdt.sonar.jar.src"
e6fd2f1eba13 add sonar with clover coverage
smith@nwoca.org
parents: 24
diff changeset
10 value="http://ivy.ssdt.nwoca.org/repository/sonar/sonar-ant-task.jar"/>
24
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
11 <ssdt:fetch dest="${user.home.ant.lib}/sonar.jar"
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
12 src="${ssdt.sonar.jar.src}"/>
27
ea29594bb799 TL-34: Switch to Jacoco for coverage analysis.
smith@nwoca.org
parents: 26
diff changeset
13 <ssdt:import-ant file="jacoco-ant.xml"/>
24
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
14
28
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
15 <ssdt:add-dependency target="init" depends="-sonar-init"/>
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
16
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
17 <target name="-sonar-init">
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
18 <echo message="Sonar: Active"/>
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
19 <if>
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
20 <contains string="${ant.project.invoked-targets}" substring="sonar"/>
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
21 <then> <property name="ignore.failing.tests" value="true"/> </then>
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
22 </if>
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
23 <property name="sonar.active" value="true"/>
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
24 </target>
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
25
26
639bec4999f2 TL-34: Scripts for sonar integration
smith@nwoca.org
parents: 25
diff changeset
26 <target name="-check-sonar">
639bec4999f2 TL-34: Scripts for sonar integration
smith@nwoca.org
parents: 25
diff changeset
27 <property file="${ssdt.devel.kit}/sonar.properties"/>
27
ea29594bb799 TL-34: Switch to Jacoco for coverage analysis.
smith@nwoca.org
parents: 26
diff changeset
28 <property name="sonar.host.url" value="http://ssdt-web-10.nwoca.org:9000" />
ea29594bb799 TL-34: Switch to Jacoco for coverage analysis.
smith@nwoca.org
parents: 26
diff changeset
29 <property name="sonar.language" value="grvy"/>
ea29594bb799 TL-34: Switch to Jacoco for coverage analysis.
smith@nwoca.org
parents: 26
diff changeset
30 <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml"/>
26
639bec4999f2 TL-34: Scripts for sonar integration
smith@nwoca.org
parents: 25
diff changeset
31 </target>
639bec4999f2 TL-34: Scripts for sonar integration
smith@nwoca.org
parents: 25
diff changeset
32
639bec4999f2 TL-34: Scripts for sonar integration
smith@nwoca.org
parents: 25
diff changeset
33 <target name="sonar" depends="project.init,-check-sonar,ivy-info,coverage.xml" if="sonar.enabled">
28
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
34 <fail unless="sonar.active" message="Sonar has not been initialized"/>
27
ea29594bb799 TL-34: Switch to Jacoco for coverage analysis.
smith@nwoca.org
parents: 26
diff changeset
35 <sonar:sonar
24
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
36 workDir="${build.dir}/sonar"
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
37 key="${ivy.project.organisation}:${ivy.project.module}"
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
38 version="${project.version}" >
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
39 <sources>
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
40 <path location="${src.dir}" />
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
41 </sources>
27
ea29594bb799 TL-34: Switch to Jacoco for coverage analysis.
smith@nwoca.org
parents: 26
diff changeset
42 <property key="sonar.core.codeCoveragePlugin" value="jacoco"/>
24
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
43 <property key="sonar.projectName" value="${ivy.project.module}"/>
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
44 <property key="sonar.language" value="${sonar.language}" />
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
45 <property key="sonar.dynamicAnalysis" value="reuseReports" />
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
46 <property key="sonar.surefire.reportsPath" value="${build.test.results.dir}"/>
27
ea29594bb799 TL-34: Switch to Jacoco for coverage analysis.
smith@nwoca.org
parents: 26
diff changeset
47 <property key="sonar.jacoco.reportPath" value="${jacoco.data.file}"/>
24
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
48 <tests>
30
22f63ae66fed TL-34: fix test source property
smith@nwoca.org
parents: 29
diff changeset
49 <path location="${test.src.dir}" />
24
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
50 </tests>
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
51 <binaries>
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
52 <path location="${build.dir}/classes" />
28
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
53 </binaries>
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
54 </sonar:sonar>
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
55 <fail if="tests.failed">Some tests failed; see details above. (sonar)</fail>
24
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
56 </target>
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
57
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
58 </project>