annotate sonar-ant.xml @ 132:8a7c3673dee9

CM-133: add fullCoverageReport task for consolidated coverage report
author smith@nwoca.org
date Thu, 06 Jun 2013 18:54:27 +0100
parents f1144aa0c01b
children 400f9d8bbf5b
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"
33
f8b0dde24622 Replace groovy script with custom task to correct memory leak
smith@nwoca.org
parents: 30
diff changeset
5 xmlns:ssdt="http://www.ssdt-ohio.org/ant/common"
f8b0dde24622 Replace groovy script with custom task to correct memory leak
smith@nwoca.org
parents: 30
diff changeset
6 xmlns:ssdtant="antlib:org.ssdt_ohio.tools.ant">
24
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
7
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
8 <description>Sonar Ant tasks</description>
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
9
25
e6fd2f1eba13 add sonar with clover coverage
smith@nwoca.org
parents: 24
diff changeset
10 <property name="ssdt.sonar.jar.src"
e6fd2f1eba13 add sonar with clover coverage
smith@nwoca.org
parents: 24
diff changeset
11 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
12 <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
13 src="${ssdt.sonar.jar.src}"/>
27
ea29594bb799 TL-34: Switch to Jacoco for coverage analysis.
smith@nwoca.org
parents: 26
diff changeset
14 <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
15
33
f8b0dde24622 Replace groovy script with custom task to correct memory leak
smith@nwoca.org
parents: 30
diff changeset
16 <ssdtant:add-dependency target="init" depends="-sonar-init"/>
28
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
17
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
18 <target name="-sonar-init">
35
7df554d8c4c1 CM-125: correct error in bundlor property mapping
smith@nwoca.org
parents: 34
diff changeset
19 <if>
7df554d8c4c1 CM-125: correct error in bundlor property mapping
smith@nwoca.org
parents: 34
diff changeset
20 <isset property="sonar.enabled"/>
7df554d8c4c1 CM-125: correct error in bundlor property mapping
smith@nwoca.org
parents: 34
diff changeset
21 <then>
7df554d8c4c1 CM-125: correct error in bundlor property mapping
smith@nwoca.org
parents: 34
diff changeset
22 <echo message="Sonar: Active"/>
7df554d8c4c1 CM-125: correct error in bundlor property mapping
smith@nwoca.org
parents: 34
diff changeset
23 </then>
7df554d8c4c1 CM-125: correct error in bundlor property mapping
smith@nwoca.org
parents: 34
diff changeset
24 </if>
28
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
25 <if>
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
26 <contains string="${ant.project.invoked-targets}" substring="sonar"/>
35
7df554d8c4c1 CM-125: correct error in bundlor property mapping
smith@nwoca.org
parents: 34
diff changeset
27 <then>
7df554d8c4c1 CM-125: correct error in bundlor property mapping
smith@nwoca.org
parents: 34
diff changeset
28 <property name="ignore.failing.tests" value="true"/>
7df554d8c4c1 CM-125: correct error in bundlor property mapping
smith@nwoca.org
parents: 34
diff changeset
29 </then>
28
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
30 </if>
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
31 <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
32 </target>
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
33
26
639bec4999f2 TL-34: Scripts for sonar integration
smith@nwoca.org
parents: 25
diff changeset
34 <target name="-check-sonar">
639bec4999f2 TL-34: Scripts for sonar integration
smith@nwoca.org
parents: 25
diff changeset
35 <property file="${ssdt.devel.kit}/sonar.properties"/>
27
ea29594bb799 TL-34: Switch to Jacoco for coverage analysis.
smith@nwoca.org
parents: 26
diff changeset
36 <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
37 <property name="sonar.language" value="grvy"/>
ea29594bb799 TL-34: Switch to Jacoco for coverage analysis.
smith@nwoca.org
parents: 26
diff changeset
38 <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
39 </target>
639bec4999f2 TL-34: Scripts for sonar integration
smith@nwoca.org
parents: 25
diff changeset
40
639bec4999f2 TL-34: Scripts for sonar integration
smith@nwoca.org
parents: 25
diff changeset
41 <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
42 <fail unless="sonar.active" message="Sonar has not been initialized"/>
42
f1144aa0c01b CM-127: Improve sonar target to handle java projects and optionally use 'build breaker' to fail builds
smith@nwoca.org
parents: 35
diff changeset
43 <property name="sonar.projectname" value="${ivy.project.module}"/>
27
ea29594bb799 TL-34: Switch to Jacoco for coverage analysis.
smith@nwoca.org
parents: 26
diff changeset
44 <sonar:sonar
24
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
45 workDir="${build.dir}/sonar"
42
f1144aa0c01b CM-127: Improve sonar target to handle java projects and optionally use 'build breaker' to fail builds
smith@nwoca.org
parents: 35
diff changeset
46 key="${ivy.project.organisation}:${sonar.projectname}"
f1144aa0c01b CM-127: Improve sonar target to handle java projects and optionally use 'build breaker' to fail builds
smith@nwoca.org
parents: 35
diff changeset
47 version="${project.version}" >
24
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
48 <sources>
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
49 <path location="${src.dir}" />
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
50 </sources>
27
ea29594bb799 TL-34: Switch to Jacoco for coverage analysis.
smith@nwoca.org
parents: 26
diff changeset
51 <property key="sonar.core.codeCoveragePlugin" value="jacoco"/>
42
f1144aa0c01b CM-127: Improve sonar target to handle java projects and optionally use 'build breaker' to fail builds
smith@nwoca.org
parents: 35
diff changeset
52 <property key="sonar.projectName" value="${sonar.projectname}"/>
24
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
53 <property key="sonar.language" value="${sonar.language}" />
42
f1144aa0c01b CM-127: Improve sonar target to handle java projects and optionally use 'build breaker' to fail builds
smith@nwoca.org
parents: 35
diff changeset
54 <property key="sonar.java.source" value="${javac.source}" />
f1144aa0c01b CM-127: Improve sonar target to handle java projects and optionally use 'build breaker' to fail builds
smith@nwoca.org
parents: 35
diff changeset
55 <property key="sonar.java.target" value="${java.target}" />
24
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
56 <property key="sonar.dynamicAnalysis" value="reuseReports" />
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
57 <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
58 <property key="sonar.jacoco.reportPath" value="${jacoco.data.file}"/>
34
2704c479a05f add jacoco itReportpath to attempt to enable coverage
smith@nwoca.org
parents: 33
diff changeset
59 <property key="sonar.jacoco.itReportPath" value="${jacoco.data.file}"/>
24
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
60 <tests>
30
22f63ae66fed TL-34: fix test source property
smith@nwoca.org
parents: 29
diff changeset
61 <path location="${test.src.dir}" />
24
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
62 </tests>
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
63 <binaries>
42
f1144aa0c01b CM-127: Improve sonar target to handle java projects and optionally use 'build breaker' to fail builds
smith@nwoca.org
parents: 35
diff changeset
64 <path location="${build.classes.dir}" />
28
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
65 </binaries>
ad0a75e20f7b TL-34: Allow sonar to publish failing tests (ant 1.8.1+)
smith@nwoca.org
parents: 27
diff changeset
66 </sonar:sonar>
42
f1144aa0c01b CM-127: Improve sonar target to handle java projects and optionally use 'build breaker' to fail builds
smith@nwoca.org
parents: 35
diff changeset
67 <fail if="tests.failed" unless="sonar.use.build.breaker">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
68 </target>
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
69
a63acb4e09f8 inital sonar-ant script to publish metrics to Sonar server
smith@nwoca.org
parents:
diff changeset
70 </project>