Mercurial > public > develkit
annotate metrics.gradle @ 235:5969e8210e0b
DEP-12: use unencrypted port for sonar analysis
author | smith@nwoca.org |
---|---|
date | Wed, 19 Oct 2016 23:36:37 +0100 |
parents | 400f9d8bbf5b |
children | 33c98751eb08 |
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 | |
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
|
18 |
134 | 19 apply plugin: me.davesmith.gradle.plugins.jaranalyzer.JarAnalyzerPlugin |
20 | |
21 jaranalyzer { | |
22 dot = true | |
23 packageFilter += 'org.slf4j*' | |
24 packageFilter += 'groovyx.*' | |
25 } | |
26 | |
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
|
27 |
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 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
|
29 |
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 apply plugin: org.sonarqube.gradle.SonarQubePlugin |
400f9d8bbf5b
DEP-13: enable sonar analysis for gradle 3.1 projects. disable sonar for ant based projects
smith@nwoca.org
parents:
232
diff
changeset
|
31 |
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 sonarqube { |
400f9d8bbf5b
DEP-13: enable sonar analysis for gradle 3.1 projects. disable sonar for ant based projects
smith@nwoca.org
parents:
232
diff
changeset
|
33 properties { |
235
5969e8210e0b
DEP-12: use unencrypted port for sonar analysis
smith@nwoca.org
parents:
233
diff
changeset
|
34 property "sonar.host.url", "http://sonar.ssdt.io:9000" |
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
|
35 property "sonar.login", System.getenv('bamboo_SONAR_TOKEN') |
400f9d8bbf5b
DEP-13: enable sonar analysis for gradle 3.1 projects. disable sonar for ant based projects
smith@nwoca.org
parents:
232
diff
changeset
|
36 property "sonar.exclusions","**/ProjectVersion*" |
400f9d8bbf5b
DEP-13: enable sonar analysis for gradle 3.1 projects. disable sonar for ant based projects
smith@nwoca.org
parents:
232
diff
changeset
|
37 } |
400f9d8bbf5b
DEP-13: enable sonar analysis for gradle 3.1 projects. disable sonar for ant based projects
smith@nwoca.org
parents:
232
diff
changeset
|
38 } |
400f9d8bbf5b
DEP-13: enable sonar analysis for gradle 3.1 projects. disable sonar for ant based projects
smith@nwoca.org
parents:
232
diff
changeset
|
39 |
85 | 40 } |
126 | 41 |
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
|
42 if (legacySonar) { |
85 | 43 |
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
|
44 apply plugin: "sonar-runner" |
400f9d8bbf5b
DEP-13: enable sonar analysis for gradle 3.1 projects. disable sonar for ant based projects
smith@nwoca.org
parents:
232
diff
changeset
|
45 ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties") |
400f9d8bbf5b
DEP-13: enable sonar analysis for gradle 3.1 projects. disable sonar for ant based projects
smith@nwoca.org
parents:
232
diff
changeset
|
46 |
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
|
47 sonarRunner { |
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 sonarProperties { |
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
|
49 property "sonar.host.url", "http://sonar.ssdt-ohio.org/" |
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 property "sonar.jdbc.url", ant.properties['sonar.jdbc.url'] |
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
|
51 property "sonar.jdbc.driverClassName", ant.properties['sonar.jdbc.driverClassName'] |
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
|
52 property "sonar.jdbc.username", ant.properties['sonar.jdbc.username'] |
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 property "sonar.jdbc.password", ant.properties['sonar.jdbc.password'] |
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
|
54 property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}" |
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 property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}" |
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
|
56 } |
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
|
57 } |
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
|
58 |
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
|
59 subprojects { |
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
|
60 afterEvaluate { project -> |
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
|
61 |
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
|
62 def groovyProject = project.plugins.hasPlugin('groovy') |
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
|
63 sonarRunner { |
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
|
64 sonarProperties { |
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
|
65 property "sonar.language", groovyProject ? 'grvy' : 'java' |
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
|
66 property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}" |
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
|
67 property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}" |
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
|
68 } |
85 | 69 } |
70 } | |
71 } | |
142
45d2396e9fc8
configure sonar to publish only for 'develop' builts.
Dave Smith <smith@nwoca.org>
parents:
135
diff
changeset
|
72 |
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
|
73 allprojects { |
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
|
74 afterEvaluate { project -> |
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
|
75 project.getTasksByName('sonarRunner',false).each { it.enabled = gradle.branchStream == 'develop' } |
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
|
76 } |
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
|
77 } |
142
45d2396e9fc8
configure sonar to publish only for 'develop' builts.
Dave Smith <smith@nwoca.org>
parents:
135
diff
changeset
|
78 } |