comparison metrics.gradle @ 128:c93df17513f1

CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
author smith@nwoca.org
date Tue, 04 Jun 2013 23:13:59 +0100
parents b2532280341e
children 253374129034
comparison
equal deleted inserted replaced
127:2a4ea22a6dd3 128:c93df17513f1
1
2 apply plugin: "sonar-runner" 1 apply plugin: "sonar-runner"
3
4 ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties") 2 ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties")
5 3
6 buildscript { 4 buildscript {
7 repositories { 5 repositories {
8 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } 6 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' }
9 maven { url 'http://repos.ssdt.nwoca.org/artifactory/repository' } 7 maven { url 'http://repos.ssdt.nwoca.org/artifactory/repository' }
10 maven { url 'http://repos.ssdt.nwoca.org/artifactory/libs-snapshots' } 8 maven { url 'http://repos.ssdt.nwoca.org/artifactory/libs-snapshots' }
11 } 9 }
12 dependencies { 10 dependencies {
13 classpath "me.davesmith:gradle-cobertura-plugin:1.0.2.SNAPSHOT" 11 classpath "me.davesmith:gradle-cobertura-plugin:1.0.2.SNAPSHOT"
14 classpath "net.sourceforge.cobertura:cobertura:1.9.4.1" 12 classpath "net.sourceforge.cobertura:cobertura:1.9.4.1"
15 } 13 }
16 } 14 }
20 property "sonar.host.url", "http://sonar.ssdt-ohio.org/" 18 property "sonar.host.url", "http://sonar.ssdt-ohio.org/"
21 property "sonar.jdbc.url", ant.properties['sonar.jdbc.url'] 19 property "sonar.jdbc.url", ant.properties['sonar.jdbc.url']
22 property "sonar.jdbc.driverClassName", ant.properties['sonar.jdbc.driverClassName'] 20 property "sonar.jdbc.driverClassName", ant.properties['sonar.jdbc.driverClassName']
23 property "sonar.jdbc.username", ant.properties['sonar.jdbc.username'] 21 property "sonar.jdbc.username", ant.properties['sonar.jdbc.username']
24 property "sonar.jdbc.password", ant.properties['sonar.jdbc.password'] 22 property "sonar.jdbc.password", ant.properties['sonar.jdbc.password']
23 property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}"
24 property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}"
25 } 25 }
26 } 26 }
27 27
28 allprojects { 28 subprojects {
29 afterEvaluate { project -> 29 afterEvaluate { project ->
30 30
31 def groovyProject = project.plugins.hasPlugin('groovy') 31 def groovyProject = project.plugins.hasPlugin('groovy')
32 def javaProject = project.plugins.hasPlugin('java')
33
34 if (groovyProject || javaProject) {
35 project.apply plugin: 'jacoco'
36
37 project.jacocoTestReport {
38 if (groovyProject) {
39 sourceDirectories = files(sourceSets.main.allGroovy.srcDirs)
40 classDirectories = files(project.sourceSets.main.output.classesDir)
41 }
42 reports {
43 xml.enabled true
44 csv.enabled false
45 html.enabled true
46 }
47 }
48
49 task coverageReport {
50 dependsOn jacocoTestReport
51 }
52
53 }
32 54
33 sonarRunner { 55 sonarRunner {
34 sonarProperties { 56 sonarProperties {
35 property "sonar.language", groovyProject ? 'grvy' : 'java' 57 property "sonar.language", groovyProject ? 'grvy' : 'java'
58 property "sonar.java.coveragePlugin", "jacoco"
59 property "sonar.jacoco.reportPath", project.test.jacoco.destPath
60 property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}"
61 property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}"
36 } 62 }
37 } 63 }
38 } 64 }
39 } 65 }