comparison 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
comparison
equal deleted inserted replaced
116:8f3ba3b811bf 117:5e06e0629f85
30 } 30 }
31 project { 31 project {
32 dynamicAnalysis = "reuseReports" 32 dynamicAnalysis = "reuseReports"
33 sourceEncoding = "UTF-8" 33 sourceEncoding = "UTF-8"
34 } 34 }
35 withGlobalProperties { props ->
36 props["sonar.language"] = "grvy"
37 }
35 } 38 }
36 39
37 class SsdtSonarSettings extends BuildAdapter implements BuildListener { 40 class SsdtSonarSettings extends BuildAdapter implements BuildListener {
38 41
39 def void projectsEvaluated(Gradle gradle) { 42 def void projectsEvaluated(Gradle gradle) {
45 def usesGroovy = configurations.any { it.name == 'groovy' } 48 def usesGroovy = configurations.any { it.name == 'groovy' }
46 apply plugin: net.saliman.gradle.plugin.cobertura.CoberturaPlugin 49 apply plugin: net.saliman.gradle.plugin.cobertura.CoberturaPlugin
47 50
48 sonar { 51 sonar {
49 project { 52 project {
50 language = usesGroovy ? 'grvy' : 'java' 53 language = usesGroovy ? 'groovy' : 'java'
51 dynamicAnalysis = "reuseReports" 54 dynamicAnalysis = "reuseReports"
52 sourceEncoding = "UTF-8" 55 sourceEncoding = "UTF-8"
53 coberturaReportPath = file("${reporting.baseDir}/cobertura/coverage.xml") 56 coberturaReportPath = file("${reporting.baseDir}/cobertura/coverage.xml")
54 withProjectProperties { props -> 57 withProjectProperties { props ->
58 if (usesGroovy) {
59 println "setting groovy profile on $p"
60 props['sonar.profile'] = 'SSDT Groovy Way'
61 }
55 props['sonar.cobertura.reportPath'] = "${reporting.baseDir}/cobertura/coverage.xml" 62 props['sonar.cobertura.reportPath'] = "${reporting.baseDir}/cobertura/coverage.xml"
56 props["sonar.cpd.skip"] = true 63 props["sonar.cpd.skip"] = true
57 props['sonar.language'] = usesGroovy ? 'grvy' : 'java' 64 props['sonar.language'] = usesGroovy ? 'grvy' : 'java'
58 } 65 }
59 } 66 }
76 def thisProject = delegate 83 def thisProject = delegate
77 def usesGroovy = thisProject.configurations.any { it.name == 'groovy' } 84 def usesGroovy = thisProject.configurations.any { it.name == 'groovy' }
78 85
79 sonar { 86 sonar {
80 project { 87 project {
81 language = usesGroovy ? 'grvy' : 'java' 88 language = usesGroovy ? 'groovy' : 'java'
82 dynamicAnalysis = "reuseReports" 89 dynamicAnalysis = "reuseReports"
83 sourceEncoding = "UTF-8" 90 sourceEncoding = "UTF-8"
84 withProjectProperties { props -> 91 withProjectProperties { props ->
85 props['sonar.language'] = usesGroovy ? 'grvy' : 'java' 92 props['sonar.language'] = usesGroovy ? 'grvy' : 'java'
86 } 93 }