Mercurial > public > develkit
annotate metrics.gradle @ 202:b217dc3b654a
USASR-1835: Attempt to fix quoting of database name in sql
author | Christopher Springer <springer@nwoca.org> |
---|---|
date | Fri, 21 Aug 2015 12:40:01 +0100 |
parents | 45d2396e9fc8 |
children | 0ca4f3c952b7 |
rev | line source |
---|---|
126 | 1 apply plugin: "sonar-runner" |
85 | 2 ant.property(file: System.getProperty('user.home') + "/.ssdt/sonar.properties") |
3 | |
131
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
4 if (!gradle.environment.containsKey('coverage')) { |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
5 gradle.environment.put('coverage', false) |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
6 } else { |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
7 gradle.environment.put('coverage', gradle.environment.coverage.toBoolean()) |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
8 } |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
9 |
133
0d8681ff046b
CM-133: fix sonar runner when coverage disabled
smith@nwoca.org
parents:
132
diff
changeset
|
10 println "metrics: coverage enabled: ${gradle.environment.coverage}" |
85 | 11 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
|
12 repositories { |
85 | 13 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } |
134 | 14 maven { url 'http://repos.ssdt.nwoca.org/artifactory/repo' } |
15 } | |
16 dependencies { | |
135 | 17 classpath 'me.davesmith:jaranalyzerplugin:0.2.0-SNAPSHOT' |
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
|
18 } |
85 | 19 } |
20 | |
134 | 21 |
22 apply plugin: me.davesmith.gradle.plugins.jaranalyzer.JarAnalyzerPlugin | |
23 | |
24 jaranalyzer { | |
25 dot = true | |
26 packageFilter += 'org.slf4j*' | |
27 packageFilter += 'groovyx.*' | |
28 } | |
29 | |
30 | |
126 | 31 sonarRunner { |
32 sonarProperties { | |
33 property "sonar.host.url", "http://sonar.ssdt-ohio.org/" | |
34 property "sonar.jdbc.url", ant.properties['sonar.jdbc.url'] | |
35 property "sonar.jdbc.driverClassName", ant.properties['sonar.jdbc.driverClassName'] | |
36 property "sonar.jdbc.username", ant.properties['sonar.jdbc.username'] | |
37 property "sonar.jdbc.password", ant.properties['sonar.jdbc.password'] | |
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
|
38 property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}" |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
39 property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}" |
117
5e06e0629f85
correct groovy language setting and force profile name
smith@nwoca.org
parents:
116
diff
changeset
|
40 } |
85 | 41 } |
126 | 42 |
132
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
43 if (gradle.environment.coverage) { |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
44 |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
45 configurations { |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
46 jacocoAntRoot |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
47 } |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
48 dependencies { |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
49 jacocoAntRoot 'org.jacoco:org.jacoco.ant:0.6.2.201302030002' |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
50 } |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
51 |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
52 task fullCoverageReport << { |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
53 ant { |
134 | 54 taskdef(name: 'jacocoreport', classname: 'org.jacoco.ant.ReportTask', classpath: configurations.jacocoAntRoot.asPath) |
132
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
55 |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
56 mkdir dir: "${buildDir.path}/reports/coverage" |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
57 |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
58 jacocoreport { |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
59 executiondata { |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
60 fileset(dir: "${buildDir.path}/coverage-results") { |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
61 include name: '*.jacoco.exec' |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
62 } |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
63 } |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
64 |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
65 structure(name: project.name) { |
131
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
66 |
132
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
67 classfiles { |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
68 subprojects.each { project -> |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
69 fileset dir: project.sourceSets.main.output.classesDir |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
70 } |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
71 } |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
72 sourcefiles(encoding: 'CP1252') { |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
73 subprojects.each { project -> |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
74 project.sourceSets.main.allGroovy.srcDirs.findAll { file(it).exists() } each { |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
75 fileset dir: "$it" |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
76 } |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
77 } |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
78 } |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
79 } |
131
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
80 |
134 | 81 xml destfile: "${buildDir.path}/reports/coverage/jacoco.xml" |
82 html destdir: "${buildDir.path}/reports/coverage" | |
132
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
83 } |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
84 } |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
85 } |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
86 |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
87 fullCoverageReport.dependsOn { |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
88 subprojects.collect { project -> |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
89 project.copyCoverageData.path |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
90 } |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
91 } |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
92 |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
93 } |
131
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
94 |
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
|
95 subprojects { |
126 | 96 afterEvaluate { project -> |
85 | 97 |
126 | 98 def groovyProject = project.plugins.hasPlugin('groovy') |
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
|
99 def javaProject = project.plugins.hasPlugin('java') |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
100 |
131
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
101 if (gradle.environment.coverage && groovyProject) { |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
102 logger.info "coverage analysis enabled" |
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
|
103 project.apply plugin: 'jacoco' |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
104 |
131
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
105 project.jacoco { |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
106 toolVersion = "0.6.3.201306030806" |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
107 } |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
108 |
130
253374129034
CM-133: disable jacoco task. causing errors in some tests (java1.7?)
smith@nwoca.org
parents:
128
diff
changeset
|
109 project.test { |
253374129034
CM-133: disable jacoco task. causing errors in some tests (java1.7?)
smith@nwoca.org
parents:
128
diff
changeset
|
110 jacoco { |
131
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
111 enabled = true |
130
253374129034
CM-133: disable jacoco task. causing errors in some tests (java1.7?)
smith@nwoca.org
parents:
128
diff
changeset
|
112 } |
253374129034
CM-133: disable jacoco task. causing errors in some tests (java1.7?)
smith@nwoca.org
parents:
128
diff
changeset
|
113 } |
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
|
114 project.jacocoTestReport { |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
115 if (groovyProject) { |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
116 sourceDirectories = files(sourceSets.main.allGroovy.srcDirs) |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
117 classDirectories = files(project.sourceSets.main.output.classesDir) |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
118 } |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
119 reports { |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
120 xml.enabled true |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
121 csv.enabled false |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
122 html.enabled true |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
123 } |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
124 } |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
125 |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
126 task coverageReport { |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
127 dependsOn jacocoTestReport |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
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
|
129 |
132
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
130 task copyCoverageData(dependsOn: test, type: Copy) { |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
131 from project.test.jacoco.destPath |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
132 into "${rootProject.buildDir.path}/coverage-results" |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
133 include 'test.exec' |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
134 rename 'test.exec', "${project.name}.jacoco.exec" |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
135 } |
8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
smith@nwoca.org
parents:
131
diff
changeset
|
136 |
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
|
137 } |
126 | 138 |
139 sonarRunner { | |
140 sonarProperties { | |
141 property "sonar.language", groovyProject ? 'grvy' : 'java' | |
133
0d8681ff046b
CM-133: fix sonar runner when coverage disabled
smith@nwoca.org
parents:
132
diff
changeset
|
142 if (gradle.environment.coverage) { |
0d8681ff046b
CM-133: fix sonar runner when coverage disabled
smith@nwoca.org
parents:
132
diff
changeset
|
143 property "sonar.java.coveragePlugin", "jacoco" |
0d8681ff046b
CM-133: fix sonar runner when coverage disabled
smith@nwoca.org
parents:
132
diff
changeset
|
144 property "sonar.jacoco.reportPath", project.test.jacoco.destPath |
0d8681ff046b
CM-133: fix sonar runner when coverage disabled
smith@nwoca.org
parents:
132
diff
changeset
|
145 } |
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
|
146 property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}" |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
147 property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}" |
85 | 148 } |
149 } | |
142
45d2396e9fc8
configure sonar to publish only for 'develop' builts.
Dave Smith <smith@nwoca.org>
parents:
135
diff
changeset
|
150 |
85 | 151 } |
126 | 152 } |
142
45d2396e9fc8
configure sonar to publish only for 'develop' builts.
Dave Smith <smith@nwoca.org>
parents:
135
diff
changeset
|
153 |
45d2396e9fc8
configure sonar to publish only for 'develop' builts.
Dave Smith <smith@nwoca.org>
parents:
135
diff
changeset
|
154 |
45d2396e9fc8
configure sonar to publish only for 'develop' builts.
Dave Smith <smith@nwoca.org>
parents:
135
diff
changeset
|
155 |
45d2396e9fc8
configure sonar to publish only for 'develop' builts.
Dave Smith <smith@nwoca.org>
parents:
135
diff
changeset
|
156 allprojects { |
45d2396e9fc8
configure sonar to publish only for 'develop' builts.
Dave Smith <smith@nwoca.org>
parents:
135
diff
changeset
|
157 afterEvaluate { project -> |
45d2396e9fc8
configure sonar to publish only for 'develop' builts.
Dave Smith <smith@nwoca.org>
parents:
135
diff
changeset
|
158 project.getTasksByName('sonarRunner',false).each { it.enabled = gradle.branchStream == 'develop' } |
45d2396e9fc8
configure sonar to publish only for 'develop' builts.
Dave Smith <smith@nwoca.org>
parents:
135
diff
changeset
|
159 } |
45d2396e9fc8
configure sonar to publish only for 'develop' builts.
Dave Smith <smith@nwoca.org>
parents:
135
diff
changeset
|
160 } |