Mercurial > public > develkit
comparison metrics.gradle @ 232:47535c8358ce
DEP-13: adjust init script to handle both 2.+ and 3.1. Disable sonar for 3.1+
author | smith@nwoca.org |
---|---|
date | Tue, 18 Oct 2016 18:29:04 +0100 |
parents | 0ca4f3c952b7 |
children | 400f9d8bbf5b |
comparison
equal
deleted
inserted
replaced
231:ce34e62224cf | 232:47535c8358ce |
---|---|
1 apply plugin: "sonar-runner" | 1 final GradleVersion gradleCurrent = GradleVersion.current() |
2 ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties") | 2 final GradleVersion gradleV31 = GradleVersion.version('3.1') |
3 | |
4 final boolean legacySonar = gradleCurrent < gradleV31 | |
5 | |
6 if (legacySonar) { | |
7 apply plugin: "sonar-runner" | |
8 ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties") | |
9 } | |
3 | 10 |
4 buildscript { | 11 buildscript { |
5 repositories { | 12 repositories { |
6 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } | 13 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } |
7 maven { url 'http://repos.ssdt.nwoca.org/artifactory/repo' } | 14 maven { url 'http://repos.ssdt.nwoca.org/artifactory/repo' } |
17 dot = true | 24 dot = true |
18 packageFilter += 'org.slf4j*' | 25 packageFilter += 'org.slf4j*' |
19 packageFilter += 'groovyx.*' | 26 packageFilter += 'groovyx.*' |
20 } | 27 } |
21 | 28 |
22 sonarRunner { | 29 if (!legacySonar) { |
23 sonarProperties { | 30 |
24 property "sonar.host.url", "http://sonar.ssdt-ohio.org/" | 31 task('sonar') << { |
25 property "sonar.jdbc.url", ant.properties['sonar.jdbc.url'] | 32 println "sonar analysis currently disabled" |
26 property "sonar.jdbc.driverClassName", ant.properties['sonar.jdbc.driverClassName'] | 33 } |
27 property "sonar.jdbc.username", ant.properties['sonar.jdbc.username'] | 34 |
28 property "sonar.jdbc.password", ant.properties['sonar.jdbc.password'] | |
29 property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}" | |
30 property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}" | |
31 } | |
32 } | 35 } |
33 | 36 |
34 subprojects { | 37 if (legacySonar) { |
35 afterEvaluate { project -> | |
36 | 38 |
37 def groovyProject = project.plugins.hasPlugin('groovy') | 39 sonarRunner { |
38 sonarRunner { | 40 sonarProperties { |
39 sonarProperties { | 41 property "sonar.host.url", "http://sonar.ssdt-ohio.org/" |
40 property "sonar.language", groovyProject ? 'grvy' : 'java' | 42 property "sonar.jdbc.url", ant.properties['sonar.jdbc.url'] |
41 property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}" | 43 property "sonar.jdbc.driverClassName", ant.properties['sonar.jdbc.driverClassName'] |
42 property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}" | 44 property "sonar.jdbc.username", ant.properties['sonar.jdbc.username'] |
45 property "sonar.jdbc.password", ant.properties['sonar.jdbc.password'] | |
46 property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}" | |
47 property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}" | |
48 } | |
49 } | |
50 | |
51 subprojects { | |
52 afterEvaluate { project -> | |
53 | |
54 def groovyProject = project.plugins.hasPlugin('groovy') | |
55 sonarRunner { | |
56 sonarProperties { | |
57 property "sonar.language", groovyProject ? 'grvy' : 'java' | |
58 property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}" | |
59 property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}" | |
60 } | |
43 } | 61 } |
44 } | 62 } |
45 } | 63 } |
64 | |
65 allprojects { | |
66 afterEvaluate { project -> | |
67 project.getTasksByName('sonarRunner',false).each { it.enabled = gradle.branchStream == 'develop' } | |
68 } | |
69 } | |
46 } | 70 } |
47 | |
48 allprojects { | |
49 afterEvaluate { project -> | |
50 project.getTasksByName('sonarRunner',false).each { it.enabled = gradle.branchStream == 'develop' } | |
51 } | |
52 } |