Mercurial > public > develkit
annotate metrics.gradle @ 117:5e06e0629f85
correct groovy language setting and force profile name
author | smith@nwoca.org |
---|---|
date | Thu, 01 Nov 2012 19:57:09 +0100 |
parents | 8f3ba3b811bf |
children | f84f1d5465c1 |
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 } | |
117
5e06e0629f85
correct groovy language setting and force profile name
smith@nwoca.org
parents:
116
diff
changeset
|
35 withGlobalProperties { props -> |
5e06e0629f85
correct groovy language setting and force profile name
smith@nwoca.org
parents:
116
diff
changeset
|
36 props["sonar.language"] = "grvy" |
5e06e0629f85
correct groovy language setting and force profile name
smith@nwoca.org
parents:
116
diff
changeset
|
37 } |
85 | 38 } |
39 | |
40 class SsdtSonarSettings extends BuildAdapter implements BuildListener { | |
41 | |
42 def void projectsEvaluated(Gradle gradle) { | |
43 Project root = gradle.getRootProject() | |
44 | |
45 def testableProjects = root.allprojects.findAll { it.configurations.any { it.name.contains('test') } } | |
46 | |
116 | 47 root.configure(testableProjects) { p -> |
85 | 48 def usesGroovy = configurations.any { it.name == 'groovy' } |
116 | 49 apply plugin: net.saliman.gradle.plugin.cobertura.CoberturaPlugin |
85 | 50 |
51 sonar { | |
52 project { | |
117
5e06e0629f85
correct groovy language setting and force profile name
smith@nwoca.org
parents:
116
diff
changeset
|
53 language = usesGroovy ? 'groovy' : 'java' |
85 | 54 dynamicAnalysis = "reuseReports" |
55 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
|
56 coberturaReportPath = file("${reporting.baseDir}/cobertura/coverage.xml") |
85 | 57 withProjectProperties { props -> |
117
5e06e0629f85
correct groovy language setting and force profile name
smith@nwoca.org
parents:
116
diff
changeset
|
58 if (usesGroovy) { |
5e06e0629f85
correct groovy language setting and force profile name
smith@nwoca.org
parents:
116
diff
changeset
|
59 println "setting groovy profile on $p" |
5e06e0629f85
correct groovy language setting and force profile name
smith@nwoca.org
parents:
116
diff
changeset
|
60 props['sonar.profile'] = 'SSDT Groovy Way' |
5e06e0629f85
correct groovy language setting and force profile name
smith@nwoca.org
parents:
116
diff
changeset
|
61 } |
108
bb3fa722df51
USASR-819: Update metrics.gradle to use reporting.baseDir instead of deprecated reportsDir
springer@nwoca.org
parents:
85
diff
changeset
|
62 props['sonar.cobertura.reportPath'] = "${reporting.baseDir}/cobertura/coverage.xml" |
85 | 63 props["sonar.cpd.skip"] = true |
116 | 64 props['sonar.language'] = usesGroovy ? 'grvy' : 'java' |
85 | 65 } |
66 } | |
116 | 67 |
85 | 68 } |
69 | |
116 | 70 cobertura { |
71 if (usesGroovy) { | |
72 coverageSourceDirs = sourceSets.main.groovy.srcDirs | |
73 } | |
74 if (gradle.bambooBuild) { | |
75 coverageFormat = 'xml' | |
76 } | |
77 } | |
78 | |
85 | 79 } |
80 | |
81 root.allprojects { | |
82 | |
83 def thisProject = delegate | |
84 def usesGroovy = thisProject.configurations.any { it.name == 'groovy' } | |
85 | |
86 sonar { | |
87 project { | |
117
5e06e0629f85
correct groovy language setting and force profile name
smith@nwoca.org
parents:
116
diff
changeset
|
88 language = usesGroovy ? 'groovy' : 'java' |
85 | 89 dynamicAnalysis = "reuseReports" |
90 sourceEncoding = "UTF-8" | |
116 | 91 withProjectProperties { props -> |
92 props['sonar.language'] = usesGroovy ? 'grvy' : 'java' | |
93 } | |
85 | 94 } |
95 } | |
96 | |
97 } | |
98 } | |
99 } |