comparison metrics.gradle @ 131:ca34c067b178

CM-133: make coverage analysis controllable by property
author smith@nwoca.org
date Wed, 05 Jun 2013 22:45:58 +0100
parents 253374129034
children 8a7c3673dee9
comparison
equal deleted inserted replaced
130:253374129034 131:ca34c067b178
1 apply plugin: "sonar-runner" 1 apply plugin: "sonar-runner"
2 ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties") 2 ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties")
3
4 if (!gradle.environment.containsKey('coverage')) {
5 gradle.environment.put('coverage', false)
6 } else {
7 gradle.environment.put('coverage', gradle.environment.coverage.toBoolean())
8 }
3 9
4 buildscript { 10 buildscript {
5 repositories { 11 repositories {
6 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } 12 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' }
7 maven { url 'http://repos.ssdt.nwoca.org/artifactory/repository' } 13 maven { url 'http://repos.ssdt.nwoca.org/artifactory/repository' }
8 maven { url 'http://repos.ssdt.nwoca.org/artifactory/libs-snapshots' } 14 maven { url 'http://repos.ssdt.nwoca.org/artifactory/libs-snapshots' }
9 }
10 dependencies {
11 classpath "me.davesmith:gradle-cobertura-plugin:1.0.2.SNAPSHOT"
12 classpath "net.sourceforge.cobertura:cobertura:1.9.4.1"
13 } 15 }
14 } 16 }
15 17
16 sonarRunner { 18 sonarRunner {
17 sonarProperties { 19 sonarProperties {
23 property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}" 25 property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}"
24 property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}" 26 property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}"
25 } 27 }
26 } 28 }
27 29
30 //gradle.rootProject.afterEvaluate { project ->
31 //
32 // project.jacocoTestReport {
33 //
34 //
35 // }
36 //
37 //}
38
39
40
28 subprojects { 41 subprojects {
29 afterEvaluate { project -> 42 afterEvaluate { project ->
30 43
31 def groovyProject = project.plugins.hasPlugin('groovy') 44 def groovyProject = project.plugins.hasPlugin('groovy')
32 def javaProject = project.plugins.hasPlugin('java') 45 def javaProject = project.plugins.hasPlugin('java')
33 46
34 if (groovyProject || javaProject) { 47 if (gradle.environment.coverage && groovyProject) {
48 logger.info "coverage analysis enabled"
35 project.apply plugin: 'jacoco' 49 project.apply plugin: 'jacoco'
50
51 project.jacoco {
52 toolVersion = "0.6.3.201306030806"
53 }
36 54
37 project.test { 55 project.test {
38 jacoco { 56 jacoco {
39 enabled = false 57 enabled = true
40 } 58 }
41 } 59 }
42 project.jacocoTestReport { 60 project.jacocoTestReport {
43 if (groovyProject) { 61 if (groovyProject) {
44 sourceDirectories = files(sourceSets.main.allGroovy.srcDirs) 62 sourceDirectories = files(sourceSets.main.allGroovy.srcDirs)