Mercurial > public > develkit
annotate metrics.gradle @ 248:c8c8766492c5
USASR-2891: Update metrics.gradle to support update to Gradle v4.2.1 and Sonar v2.5
author | Christopher Springer <springer@nwoca.org> |
---|---|
date | Mon, 23 Oct 2017 18:52:24 +0100 |
parents | 60c552fce00d |
children | 969e33b82a99 |
rev | line source |
---|---|
232
47535c8358ce
DEP-13: adjust init script to handle both 2.+ and 3.1. Disable sonar for 3.1+
smith@nwoca.org
parents:
214
diff
changeset
|
1 final GradleVersion gradleCurrent = GradleVersion.current() |
47535c8358ce
DEP-13: adjust init script to handle both 2.+ and 3.1. Disable sonar for 3.1+
smith@nwoca.org
parents:
214
diff
changeset
|
2 final GradleVersion gradleV31 = GradleVersion.version('3.1') |
47535c8358ce
DEP-13: adjust init script to handle both 2.+ and 3.1. Disable sonar for 3.1+
smith@nwoca.org
parents:
214
diff
changeset
|
3 |
47535c8358ce
DEP-13: adjust init script to handle both 2.+ and 3.1. Disable sonar for 3.1+
smith@nwoca.org
parents:
214
diff
changeset
|
4 final boolean legacySonar = gradleCurrent < gradleV31 |
233
400f9d8bbf5b
DEP-13: enable sonar analysis for gradle 3.1 projects. disable sonar for ant based projects
smith@nwoca.org
parents:
232
diff
changeset
|
5 final boolean newSonar = !legacySonar |
85 | 6 |
7 buildscript { | |
248
c8c8766492c5
USASR-2891: Update metrics.gradle to support update to Gradle v4.2.1 and Sonar v2.5
Christopher Springer <springer@nwoca.org>
parents:
239
diff
changeset
|
8 final GradleVersion gradleV421 = GradleVersion.version('4.2.1') |
c8c8766492c5
USASR-2891: Update metrics.gradle to support update to Gradle v4.2.1 and Sonar v2.5
Christopher Springer <springer@nwoca.org>
parents:
239
diff
changeset
|
9 |
128
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
10 repositories { |
85 | 11 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } |
134 | 12 maven { url 'http://repos.ssdt.nwoca.org/artifactory/repo' } |
13 } | |
14 dependencies { | |
135 | 15 classpath 'me.davesmith:jaranalyzerplugin:0.2.0-SNAPSHOT' |
248
c8c8766492c5
USASR-2891: Update metrics.gradle to support update to Gradle v4.2.1 and Sonar v2.5
Christopher Springer <springer@nwoca.org>
parents:
239
diff
changeset
|
16 classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:${GradleVersion.current() >= gradleV421 ? '2.5' : '2.2'}" |
128
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
17 } |
85 | 18 } |
19 | |
134 | 20 apply plugin: me.davesmith.gradle.plugins.jaranalyzer.JarAnalyzerPlugin |
21 | |
22 jaranalyzer { | |
23 dot = true | |
24 packageFilter += 'org.slf4j*' | |
25 packageFilter += 'groovyx.*' | |
26 } | |
27 | |
233
400f9d8bbf5b
DEP-13: enable sonar analysis for gradle 3.1 projects. disable sonar for ant based projects
smith@nwoca.org
parents:
232
diff
changeset
|
28 |
400f9d8bbf5b
DEP-13: enable sonar analysis for gradle 3.1 projects. disable sonar for ant based projects
smith@nwoca.org
parents:
232
diff
changeset
|
29 if (newSonar) { |
232
47535c8358ce
DEP-13: adjust init script to handle both 2.+ and 3.1. Disable sonar for 3.1+
smith@nwoca.org
parents:
214
diff
changeset
|
30 |
237 | 31 apply plugin: org.sonarqube.gradle.SonarQubePlugin |
233
400f9d8bbf5b
DEP-13: enable sonar analysis for gradle 3.1 projects. disable sonar for ant based projects
smith@nwoca.org
parents:
232
diff
changeset
|
32 |
237 | 33 sonarqube { |
34 properties { | |
35 property "sonar.host.url", "http://sonar.ssdt.io:9000" | |
36 property "sonar.login", System.getenv('bamboo_SONAR_TOKEN') | |
37 property "sonar.exclusions","**/ProjectVersion*" | |
38 } | |
39 } | |
238
d7f0ae9e28af
DEP-12: restrict analysis to default, release and hotfox branches
smith@nwoca.org
parents:
237
diff
changeset
|
40 |
d7f0ae9e28af
DEP-12: restrict analysis to default, release and hotfox branches
smith@nwoca.org
parents:
237
diff
changeset
|
41 allprojects { |
d7f0ae9e28af
DEP-12: restrict analysis to default, release and hotfox branches
smith@nwoca.org
parents:
237
diff
changeset
|
42 afterEvaluate { project -> |
d7f0ae9e28af
DEP-12: restrict analysis to default, release and hotfox branches
smith@nwoca.org
parents:
237
diff
changeset
|
43 project.getTasksByName('sonarqube',false).each { |
d7f0ae9e28af
DEP-12: restrict analysis to default, release and hotfox branches
smith@nwoca.org
parents:
237
diff
changeset
|
44 it.enabled = gradle.branchStream in ['develop','release','hotfix' ] |
d7f0ae9e28af
DEP-12: restrict analysis to default, release and hotfox branches
smith@nwoca.org
parents:
237
diff
changeset
|
45 } |
d7f0ae9e28af
DEP-12: restrict analysis to default, release and hotfox branches
smith@nwoca.org
parents:
237
diff
changeset
|
46 } |
d7f0ae9e28af
DEP-12: restrict analysis to default, release and hotfox branches
smith@nwoca.org
parents:
237
diff
changeset
|
47 } |
85 | 48 } |
126 | 49 |
232
47535c8358ce
DEP-13: adjust init script to handle both 2.+ and 3.1. Disable sonar for 3.1+
smith@nwoca.org
parents:
214
diff
changeset
|
50 if (legacySonar) { |
85 | 51 |
239 | 52 task('sonar') << { |
53 println "legacy sonar disabled" | |
54 } | |
232
47535c8358ce
DEP-13: adjust init script to handle both 2.+ and 3.1. Disable sonar for 3.1+
smith@nwoca.org
parents:
214
diff
changeset
|
55 |
248
c8c8766492c5
USASR-2891: Update metrics.gradle to support update to Gradle v4.2.1 and Sonar v2.5
Christopher Springer <springer@nwoca.org>
parents:
239
diff
changeset
|
56 } |