Mercurial > public > develkit
annotate metrics.gradle @ 116:8f3ba3b811bf
update cobertura configuration
author | smith@nwoca.org |
---|---|
date | Thu, 01 Nov 2012 15:45:40 +0100 |
parents | bb3fa722df51 |
children | 5e06e0629f85 |
rev | line source |
---|---|
85 | 1 |
2 apply plugin: "sonar" | |
3 | |
4 gradle.addListener(new SsdtSonarSettings()) | |
5 | |
6 ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties") | |
7 | |
8 buildscript { | |
9 repositories { | |
10 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } | |
116 | 11 maven { url 'http://repos.ssdt.nwoca.org/artifactory/repository' } |
12 maven { url 'http://repos.ssdt.nwoca.org/artifactory/libs-snapshots' } | |
13 } | |
85 | 14 dependencies { |
116 | 15 classpath "me.davesmith:gradle-cobertura-plugin:1.0.2.SNAPSHOT" |
16 classpath "net.sourceforge.cobertura:cobertura:1.9.4.1" | |
85 | 17 } |
18 } | |
19 | |
20 | |
21 sonar { | |
22 server { | |
23 url = "http://sonar.ssdt-ohio.org" | |
24 } | |
25 database { | |
26 url = ant.properties['sonar.jdbc.url'] | |
27 driverClassName = ant.properties['sonar.jdbc.driverClassName'] | |
28 username = ant.properties['sonar.jdbc.username'] | |
29 password = ant.properties['sonar.jdbc.password'] | |
30 } | |
31 project { | |
32 dynamicAnalysis = "reuseReports" | |
33 sourceEncoding = "UTF-8" | |
34 } | |
35 } | |
36 | |
37 class SsdtSonarSettings extends BuildAdapter implements BuildListener { | |
38 | |
39 def void projectsEvaluated(Gradle gradle) { | |
40 Project root = gradle.getRootProject() | |
41 | |
42 def testableProjects = root.allprojects.findAll { it.configurations.any { it.name.contains('test') } } | |
43 | |
116 | 44 root.configure(testableProjects) { p -> |
85 | 45 def usesGroovy = configurations.any { it.name == 'groovy' } |
116 | 46 apply plugin: net.saliman.gradle.plugin.cobertura.CoberturaPlugin |
85 | 47 |
48 sonar { | |
49 project { | |
50 language = usesGroovy ? 'grvy' : 'java' | |
51 dynamicAnalysis = "reuseReports" | |
52 sourceEncoding = "UTF-8" | |
108
bb3fa722df51
USASR-819: Update metrics.gradle to use reporting.baseDir instead of deprecated reportsDir
springer@nwoca.org
parents:
85
diff
changeset
|
53 coberturaReportPath = file("${reporting.baseDir}/cobertura/coverage.xml") |
85 | 54 withProjectProperties { props -> |
108
bb3fa722df51
USASR-819: Update metrics.gradle to use reporting.baseDir instead of deprecated reportsDir
springer@nwoca.org
parents:
85
diff
changeset
|
55 props['sonar.cobertura.reportPath'] = "${reporting.baseDir}/cobertura/coverage.xml" |
85 | 56 props["sonar.cpd.skip"] = true |
116 | 57 props['sonar.language'] = usesGroovy ? 'grvy' : 'java' |
85 | 58 } |
59 } | |
116 | 60 |
85 | 61 } |
62 | |
116 | 63 cobertura { |
64 if (usesGroovy) { | |
65 coverageSourceDirs = sourceSets.main.groovy.srcDirs | |
66 } | |
67 if (gradle.bambooBuild) { | |
68 coverageFormat = 'xml' | |
69 } | |
70 } | |
71 | |
85 | 72 } |
73 | |
74 root.allprojects { | |
75 | |
76 def thisProject = delegate | |
77 def usesGroovy = thisProject.configurations.any { it.name == 'groovy' } | |
78 | |
79 sonar { | |
80 project { | |
81 language = usesGroovy ? 'grvy' : 'java' | |
82 dynamicAnalysis = "reuseReports" | |
83 sourceEncoding = "UTF-8" | |
116 | 84 withProjectProperties { props -> |
85 props['sonar.language'] = usesGroovy ? 'grvy' : 'java' | |
86 } | |
85 | 87 } |
88 } | |
89 | |
90 } | |
91 } | |
92 } |