comparison sonar-ant.xml @ 42:f1144aa0c01b

CM-127: Improve sonar target to handle java projects and optionally use 'build breaker' to fail builds
author smith@nwoca.org
date Tue, 07 Jun 2011 21:44:14 -0400
parents 7df554d8c4c1
children 400f9d8bbf5b
comparison
equal deleted inserted replaced
41:139a3611ae99 42:f1144aa0c01b
38 <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml"/> 38 <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml"/>
39 </target> 39 </target>
40 40
41 <target name="sonar" depends="project.init,-check-sonar,ivy-info,coverage.xml" if="sonar.enabled"> 41 <target name="sonar" depends="project.init,-check-sonar,ivy-info,coverage.xml" if="sonar.enabled">
42 <fail unless="sonar.active" message="Sonar has not been initialized"/> 42 <fail unless="sonar.active" message="Sonar has not been initialized"/>
43 <property name="sonar.projectname" value="${ivy.project.module}"/>
43 <sonar:sonar 44 <sonar:sonar
44 workDir="${build.dir}/sonar" 45 workDir="${build.dir}/sonar"
45 key="${ivy.project.organisation}:${ivy.project.module}" 46 key="${ivy.project.organisation}:${sonar.projectname}"
46 version="${project.version}" > 47 version="${project.version}" >
47 <sources> 48 <sources>
48 <path location="${src.dir}" /> 49 <path location="${src.dir}" />
49 </sources> 50 </sources>
50 <property key="sonar.core.codeCoveragePlugin" value="jacoco"/> 51 <property key="sonar.core.codeCoveragePlugin" value="jacoco"/>
51 <property key="sonar.projectName" value="${ivy.project.module}"/> 52 <property key="sonar.projectName" value="${sonar.projectname}"/>
52 <property key="sonar.language" value="${sonar.language}" /> 53 <property key="sonar.language" value="${sonar.language}" />
54 <property key="sonar.java.source" value="${javac.source}" />
55 <property key="sonar.java.target" value="${java.target}" />
53 <property key="sonar.dynamicAnalysis" value="reuseReports" /> 56 <property key="sonar.dynamicAnalysis" value="reuseReports" />
54 <property key="sonar.surefire.reportsPath" value="${build.test.results.dir}"/> 57 <property key="sonar.surefire.reportsPath" value="${build.test.results.dir}"/>
55 <property key="sonar.jacoco.reportPath" value="${jacoco.data.file}"/> 58 <property key="sonar.jacoco.reportPath" value="${jacoco.data.file}"/>
56 <property key="sonar.jacoco.itReportPath" value="${jacoco.data.file}"/> 59 <property key="sonar.jacoco.itReportPath" value="${jacoco.data.file}"/>
57 <tests> 60 <tests>
58 <path location="${test.src.dir}" /> 61 <path location="${test.src.dir}" />
59 </tests> 62 </tests>
60 <binaries> 63 <binaries>
61 <path location="${build.dir}/classes" /> 64 <path location="${build.classes.dir}" />
62 </binaries> 65 </binaries>
63 </sonar:sonar> 66 </sonar:sonar>
64 <fail if="tests.failed">Some tests failed; see details above. (sonar)</fail> 67 <fail if="tests.failed" unless="sonar.use.build.breaker">Some tests failed; see details above. (sonar)</fail>
65 </target> 68 </target>
66 69
67 </project> 70 </project>