Mercurial > public > develkit
annotate metrics.gradle @ 239:60c552fce00d
DEP-13: disable legacy sonar analysis
author | smith@nwoca.org |
---|---|
date | Fri, 21 Oct 2016 18:16:09 +0100 |
parents | d7f0ae9e28af |
children | c8c8766492c5 |
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 { | |
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
|
8 repositories { |
85 | 9 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } |
134 | 10 maven { url 'http://repos.ssdt.nwoca.org/artifactory/repo' } |
11 } | |
12 dependencies { | |
135 | 13 classpath 'me.davesmith:jaranalyzerplugin:0.2.0-SNAPSHOT' |
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
|
14 classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin: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
|
15 } |
85 | 16 } |
17 | |
134 | 18 apply plugin: me.davesmith.gradle.plugins.jaranalyzer.JarAnalyzerPlugin |
19 | |
20 jaranalyzer { | |
21 dot = true | |
22 packageFilter += 'org.slf4j*' | |
23 packageFilter += 'groovyx.*' | |
24 } | |
25 | |
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
|
26 |
400f9d8bbf5b
DEP-13: enable sonar analysis for gradle 3.1 projects. disable sonar for ant based projects
smith@nwoca.org
parents:
232
diff
changeset
|
27 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
|
28 |
237 | 29 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
|
30 |
237 | 31 sonarqube { |
32 properties { | |
33 property "sonar.host.url", "http://sonar.ssdt.io:9000" | |
34 property "sonar.login", System.getenv('bamboo_SONAR_TOKEN') | |
35 property "sonar.exclusions","**/ProjectVersion*" | |
36 } | |
37 } | |
238
d7f0ae9e28af
DEP-12: restrict analysis to default, release and hotfox branches
smith@nwoca.org
parents:
237
diff
changeset
|
38 |
d7f0ae9e28af
DEP-12: restrict analysis to default, release and hotfox branches
smith@nwoca.org
parents:
237
diff
changeset
|
39 allprojects { |
d7f0ae9e28af
DEP-12: restrict analysis to default, release and hotfox branches
smith@nwoca.org
parents:
237
diff
changeset
|
40 afterEvaluate { project -> |
d7f0ae9e28af
DEP-12: restrict analysis to default, release and hotfox branches
smith@nwoca.org
parents:
237
diff
changeset
|
41 project.getTasksByName('sonarqube',false).each { |
d7f0ae9e28af
DEP-12: restrict analysis to default, release and hotfox branches
smith@nwoca.org
parents:
237
diff
changeset
|
42 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
|
43 } |
d7f0ae9e28af
DEP-12: restrict analysis to default, release and hotfox branches
smith@nwoca.org
parents:
237
diff
changeset
|
44 } |
d7f0ae9e28af
DEP-12: restrict analysis to default, release and hotfox branches
smith@nwoca.org
parents:
237
diff
changeset
|
45 } |
85 | 46 } |
126 | 47 |
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
|
48 if (legacySonar) { |
85 | 49 |
239 | 50 task('sonar') << { |
51 println "legacy sonar disabled" | |
52 } | |
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
|
53 |
142
45d2396e9fc8
configure sonar to publish only for 'develop' builts.
Dave Smith <smith@nwoca.org>
parents:
135
diff
changeset
|
54 } |