Mercurial > public > develkit
annotate metrics.gradle @ 131:ca34c067b178
CM-133: make coverage analysis controllable by property
author | smith@nwoca.org |
---|---|
date | Wed, 05 Jun 2013 22:45:58 +0100 |
parents | 253374129034 |
children | 8a7c3673dee9 |
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 |
85 | 10 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
|
11 repositories { |
85 | 12 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } |
116 | 13 maven { url 'http://repos.ssdt.nwoca.org/artifactory/repository' } |
14 maven { url 'http://repos.ssdt.nwoca.org/artifactory/libs-snapshots' } | |
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 | |
126 | 18 sonarRunner { |
19 sonarProperties { | |
20 property "sonar.host.url", "http://sonar.ssdt-ohio.org/" | |
21 property "sonar.jdbc.url", ant.properties['sonar.jdbc.url'] | |
22 property "sonar.jdbc.driverClassName", ant.properties['sonar.jdbc.driverClassName'] | |
23 property "sonar.jdbc.username", ant.properties['sonar.jdbc.username'] | |
24 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
|
25 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
|
26 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
|
27 } |
85 | 28 } |
126 | 29 |
131
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
30 //gradle.rootProject.afterEvaluate { project -> |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
31 // |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
32 // project.jacocoTestReport { |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
33 // |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
34 // |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
35 // } |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
36 // |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
37 //} |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
38 |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
39 |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
40 |
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
|
41 subprojects { |
126 | 42 afterEvaluate { project -> |
85 | 43 |
126 | 44 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
|
45 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
|
46 |
131
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
47 if (gradle.environment.coverage && groovyProject) { |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
48 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
|
49 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
|
50 |
131
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
51 project.jacoco { |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
52 toolVersion = "0.6.3.201306030806" |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
53 } |
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
54 |
130
253374129034
CM-133: disable jacoco task. causing errors in some tests (java1.7?)
smith@nwoca.org
parents:
128
diff
changeset
|
55 project.test { |
253374129034
CM-133: disable jacoco task. causing errors in some tests (java1.7?)
smith@nwoca.org
parents:
128
diff
changeset
|
56 jacoco { |
131
ca34c067b178
CM-133: make coverage analysis controllable by property
smith@nwoca.org
parents:
130
diff
changeset
|
57 enabled = true |
130
253374129034
CM-133: disable jacoco task. causing errors in some tests (java1.7?)
smith@nwoca.org
parents:
128
diff
changeset
|
58 } |
253374129034
CM-133: disable jacoco task. causing errors in some tests (java1.7?)
smith@nwoca.org
parents:
128
diff
changeset
|
59 } |
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
|
60 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
|
61 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
|
62 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
|
63 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
|
64 } |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
65 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
|
66 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
|
67 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
|
68 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
|
69 } |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
70 } |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
71 |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
72 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
|
73 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
|
74 } |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
75 |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
76 } |
126 | 77 |
78 sonarRunner { | |
79 sonarProperties { | |
80 property "sonar.language", groovyProject ? 'grvy' : 'java' | |
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
|
81 property "sonar.java.coveragePlugin", "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
|
82 property "sonar.jacoco.reportPath", project.test.jacoco.destPath |
c93df17513f1
CM-133: add jacoco for standard coverage reports. Add sonar properties for SCM and bamboo plan
smith@nwoca.org
parents:
126
diff
changeset
|
83 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
|
84 property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}" |
85 | 85 } |
86 } | |
87 } | |
126 | 88 } |