comparison sonar-ant.xml @ 233:400f9d8bbf5b

DEP-13: enable sonar analysis for gradle 3.1 projects. disable sonar for ant based projects
author smith@nwoca.org
date Wed, 19 Oct 2016 22:42:08 +0100
parents f1144aa0c01b
children 49e9edc80170
comparison
equal deleted inserted replaced
232:47535c8358ce 233:400f9d8bbf5b
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <project name="sonar-project-tasks" default="" basedir="." 2 <project name="sonar-project-tasks" default="" basedir="."
3 xmlns:ivy="antlib:fr.jayasoft.ivy.ant" 3 xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
4 xmlns:sonar="antlib:org.sonar.ant"
5 xmlns:ssdt="http://www.ssdt-ohio.org/ant/common"
6 xmlns:ssdtant="antlib:org.ssdt_ohio.tools.ant">
7 4
8 <description>Sonar Ant tasks</description> 5 <description>Sonar Ant tasks - disabled 19-Oct-2016/djs</description>
9 6
10 <property name="ssdt.sonar.jar.src" 7 <target name="sonar" if="sonar.enabled">
11 value="http://ivy.ssdt.nwoca.org/repository/sonar/sonar-ant-task.jar"/> 8 <echo message="ant based sonar analysis has been dislabled"/>
12 <ssdt:fetch dest="${user.home.ant.lib}/sonar.jar"
13 src="${ssdt.sonar.jar.src}"/>
14 <ssdt:import-ant file="jacoco-ant.xml"/>
15
16 <ssdtant:add-dependency target="init" depends="-sonar-init"/>
17
18 <target name="-sonar-init">
19 <if>
20 <isset property="sonar.enabled"/>
21 <then>
22 <echo message="Sonar: Active"/>
23 </then>
24 </if>
25 <if>
26 <contains string="${ant.project.invoked-targets}" substring="sonar"/>
27 <then>
28 <property name="ignore.failing.tests" value="true"/>
29 </then>
30 </if>
31 <property name="sonar.active" value="true"/>
32 </target>
33
34 <target name="-check-sonar">
35 <property file="${ssdt.devel.kit}/sonar.properties"/>
36 <property name="sonar.host.url" value="http://ssdt-web-10.nwoca.org:9000" />
37 <property name="sonar.language" value="grvy"/>
38 <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml"/>
39 </target>
40
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"/>
43 <property name="sonar.projectname" value="${ivy.project.module}"/>
44 <sonar:sonar
45 workDir="${build.dir}/sonar"
46 key="${ivy.project.organisation}:${sonar.projectname}"
47 version="${project.version}" >
48 <sources>
49 <path location="${src.dir}" />
50 </sources>
51 <property key="sonar.core.codeCoveragePlugin" value="jacoco"/>
52 <property key="sonar.projectName" value="${sonar.projectname}"/>
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}" />
56 <property key="sonar.dynamicAnalysis" value="reuseReports" />
57 <property key="sonar.surefire.reportsPath" value="${build.test.results.dir}"/>
58 <property key="sonar.jacoco.reportPath" value="${jacoco.data.file}"/>
59 <property key="sonar.jacoco.itReportPath" value="${jacoco.data.file}"/>
60 <tests>
61 <path location="${test.src.dir}" />
62 </tests>
63 <binaries>
64 <path location="${build.classes.dir}" />
65 </binaries>
66 </sonar:sonar>
67 <fail if="tests.failed" unless="sonar.use.build.breaker">Some tests failed; see details above. (sonar)</fail>
68 </target> 9 </target>
69 10
70 </project> 11 </project>