comparison metrics.gradle @ 233:400f9d8bbf5b

DEP-13: enable sonar analysis for gradle 3.1 projects. disable sonar for ant based projects
author smith@nwoca.org
date Wed, 19 Oct 2016 22:42:08 +0100
parents 47535c8358ce
children 5969e8210e0b
comparison
equal deleted inserted replaced
232:47535c8358ce 233:400f9d8bbf5b
1 final GradleVersion gradleCurrent = GradleVersion.current() 1 final GradleVersion gradleCurrent = GradleVersion.current()
2 final GradleVersion gradleV31 = GradleVersion.version('3.1') 2 final GradleVersion gradleV31 = GradleVersion.version('3.1')
3 3
4 final boolean legacySonar = gradleCurrent < gradleV31 4 final boolean legacySonar = gradleCurrent < gradleV31
5 5 final boolean newSonar = !legacySonar
6 if (legacySonar) {
7 apply plugin: "sonar-runner"
8 ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties")
9 }
10 6
11 buildscript { 7 buildscript {
12 repositories { 8 repositories {
13 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } 9 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' }
14 maven { url 'http://repos.ssdt.nwoca.org/artifactory/repo' } 10 maven { url 'http://repos.ssdt.nwoca.org/artifactory/repo' }
15 } 11 }
16 dependencies { 12 dependencies {
17 classpath 'me.davesmith:jaranalyzerplugin:0.2.0-SNAPSHOT' 13 classpath 'me.davesmith:jaranalyzerplugin:0.2.0-SNAPSHOT'
14 classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.2"
18 } 15 }
19 } 16 }
17
20 18
21 apply plugin: me.davesmith.gradle.plugins.jaranalyzer.JarAnalyzerPlugin 19 apply plugin: me.davesmith.gradle.plugins.jaranalyzer.JarAnalyzerPlugin
22 20
23 jaranalyzer { 21 jaranalyzer {
24 dot = true 22 dot = true
25 packageFilter += 'org.slf4j*' 23 packageFilter += 'org.slf4j*'
26 packageFilter += 'groovyx.*' 24 packageFilter += 'groovyx.*'
27 } 25 }
28 26
29 if (!legacySonar) {
30 27
31 task('sonar') << { 28 if (newSonar) {
32 println "sonar analysis currently disabled"
33 }
34 29
30 apply plugin: org.sonarqube.gradle.SonarQubePlugin
31
32 sonarqube {
33 properties {
34 property "sonar.host.url", "https://sonar.ssdt.io"
35 property "sonar.login", System.getenv('bamboo_SONAR_TOKEN')
36 property "sonar.exclusions","**/ProjectVersion*"
37 }
38 }
39
35 } 40 }
36 41
37 if (legacySonar) { 42 if (legacySonar) {
43
44 apply plugin: "sonar-runner"
45 ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties")
38 46
39 sonarRunner { 47 sonarRunner {
40 sonarProperties { 48 sonarProperties {
41 property "sonar.host.url", "http://sonar.ssdt-ohio.org/" 49 property "sonar.host.url", "http://sonar.ssdt-ohio.org/"
42 property "sonar.jdbc.url", ant.properties['sonar.jdbc.url'] 50 property "sonar.jdbc.url", ant.properties['sonar.jdbc.url']