comparison metrics.gradle @ 116:8f3ba3b811bf

update cobertura configuration
author smith@nwoca.org
date Thu, 01 Nov 2012 15:45:40 +0100
parents bb3fa722df51
children 5e06e0629f85
comparison
equal deleted inserted replaced
115:8ddd1a6fa4ea 116:8f3ba3b811bf
6 ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties") 6 ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties")
7 7
8 buildscript { 8 buildscript {
9 repositories { 9 repositories {
10 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } 10 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' }
11 } 11 maven { url 'http://repos.ssdt.nwoca.org/artifactory/repository' }
12 maven { url 'http://repos.ssdt.nwoca.org/artifactory/libs-snapshots' }
13 }
12 dependencies { 14 dependencies {
13 classpath "gradle_cobertura:gradle_cobertura:1.0" 15 classpath "me.davesmith:gradle-cobertura-plugin:1.0.2.SNAPSHOT"
16 classpath "net.sourceforge.cobertura:cobertura:1.9.4.1"
14 } 17 }
15 } 18 }
16 19
17 20
18 sonar { 21 sonar {
36 def void projectsEvaluated(Gradle gradle) { 39 def void projectsEvaluated(Gradle gradle) {
37 Project root = gradle.getRootProject() 40 Project root = gradle.getRootProject()
38 41
39 def testableProjects = root.allprojects.findAll { it.configurations.any { it.name.contains('test') } } 42 def testableProjects = root.allprojects.findAll { it.configurations.any { it.name.contains('test') } }
40 43
41 root.configure(testableProjects) { -> 44 root.configure(testableProjects) { p ->
42 def usesGroovy = configurations.any { it.name == 'groovy' } 45 def usesGroovy = configurations.any { it.name == 'groovy' }
43 apply { 46 apply plugin: net.saliman.gradle.plugin.cobertura.CoberturaPlugin
44 // plugin com.orbitz.gradle.cobertura.CoberturaPlugin
45 }
46 47
47 sonar { 48 sonar {
48 project { 49 project {
49 language = usesGroovy ? 'grvy' : 'java' 50 language = usesGroovy ? 'grvy' : 'java'
50 dynamicAnalysis = "reuseReports" 51 dynamicAnalysis = "reuseReports"
51 sourceEncoding = "UTF-8" 52 sourceEncoding = "UTF-8"
52 coberturaReportPath = file("${reporting.baseDir}/cobertura/coverage.xml") 53 coberturaReportPath = file("${reporting.baseDir}/cobertura/coverage.xml")
53 withProjectProperties { props -> 54 withProjectProperties { props ->
54 props['sonar.cobertura.reportPath'] = "${reporting.baseDir}/cobertura/coverage.xml" 55 props['sonar.cobertura.reportPath'] = "${reporting.baseDir}/cobertura/coverage.xml"
55 props["sonar.cpd.skip"] = true 56 props["sonar.cpd.skip"] = true
57 props['sonar.language'] = usesGroovy ? 'grvy' : 'java'
56 } 58 }
57 } 59 }
60
58 } 61 }
59 62
60 // cobertura { 63 cobertura {
61 // if (usesGroovy) { 64 if (usesGroovy) {
62 // coverageSourceDirs = sourceSets.main.groovy.srcDirs 65 coverageSourceDirs = sourceSets.main.groovy.srcDirs
63 // } 66 }
64 // } 67 if (gradle.bambooBuild) {
65 68 coverageFormat = 'xml'
69 }
70 }
71
66 } 72 }
67 73
68 root.allprojects { 74 root.allprojects {
69 75
70 def thisProject = delegate 76 def thisProject = delegate
73 sonar { 79 sonar {
74 project { 80 project {
75 language = usesGroovy ? 'grvy' : 'java' 81 language = usesGroovy ? 'grvy' : 'java'
76 dynamicAnalysis = "reuseReports" 82 dynamicAnalysis = "reuseReports"
77 sourceEncoding = "UTF-8" 83 sourceEncoding = "UTF-8"
84 withProjectProperties { props ->
85 props['sonar.language'] = usesGroovy ? 'grvy' : 'java'
86 }
78 } 87 }
79 } 88 }
80 89
81 } 90 }
82 } 91 }