annotate metrics.gradle @ 99:333e489c1188

add ivy artifact by name pattern
author smith@nwoca.org
date Tue, 06 Mar 2012 22:09:24 +0000
parents f36eeb411845
children bb3fa722df51
rev   line source
85
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
1
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
2 apply plugin: "sonar"
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
3
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
4 gradle.addListener(new SsdtSonarSettings())
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
5
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
6 ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties")
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
7
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
8 buildscript {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
9 repositories {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
10 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
11 }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
12 dependencies {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
13 classpath "gradle_cobertura:gradle_cobertura:1.0"
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
14 }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
15 }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
16
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
17
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
18 sonar {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
19 server {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
20 url = "http://sonar.ssdt-ohio.org"
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
21 }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
22 database {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
23 url = ant.properties['sonar.jdbc.url']
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
24 driverClassName = ant.properties['sonar.jdbc.driverClassName']
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
25 username = ant.properties['sonar.jdbc.username']
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
26 password = ant.properties['sonar.jdbc.password']
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
27 }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
28 project {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
29 dynamicAnalysis = "reuseReports"
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
30 sourceEncoding = "UTF-8"
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
31 }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
32 }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
33
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
34 class SsdtSonarSettings extends BuildAdapter implements BuildListener {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
35
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
36 def void projectsEvaluated(Gradle gradle) {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
37 Project root = gradle.getRootProject()
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
38
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
39 def testableProjects = root.allprojects.findAll { it.configurations.any { it.name.contains('test') } }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
40
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
41 root.configure(testableProjects) { ->
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
42 def usesGroovy = configurations.any { it.name == 'groovy' }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
43 apply {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
44 // plugin com.orbitz.gradle.cobertura.CoberturaPlugin
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
45 }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
46
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
47 sonar {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
48 project {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
49 language = usesGroovy ? 'grvy' : 'java'
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
50 dynamicAnalysis = "reuseReports"
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
51 sourceEncoding = "UTF-8"
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
52 coberturaReportPath = file("$reportsDir/cobertura/coverage.xml")
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
53 withProjectProperties { props ->
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
54 props['sonar.cobertura.reportPath'] = "$reportsDir/cobertura/coverage.xml"
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
55 props["sonar.cpd.skip"] = true
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
56 }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
57 }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
58 }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
59
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
60 // cobertura {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
61 // if (usesGroovy) {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
62 // coverageSourceDirs = sourceSets.main.groovy.srcDirs
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
63 // }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
64 // }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
65
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
66 }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
67
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
68 root.allprojects {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
69
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
70 def thisProject = delegate
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
71 def usesGroovy = thisProject.configurations.any { it.name == 'groovy' }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
72
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
73 sonar {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
74 project {
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
75 language = usesGroovy ? 'grvy' : 'java'
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
76 dynamicAnalysis = "reuseReports"
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
77 sourceEncoding = "UTF-8"
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
78 }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
79 }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
80
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
81 }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
82 }
f36eeb411845 add sonar publishing
smith@nwoca.org
parents:
diff changeset
83 }