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