Mercurial > public > develkit
comparison metrics.gradle @ 132:8a7c3673dee9
CM-133: add fullCoverageReport task for consolidated coverage report
author | smith@nwoca.org |
---|---|
date | Thu, 06 Jun 2013 18:54:27 +0100 |
parents | ca34c067b178 |
children | 0d8681ff046b |
comparison
equal
deleted
inserted
replaced
131:ca34c067b178 | 132:8a7c3673dee9 |
---|---|
25 property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}" | 25 property "sonar.build-stability.url", "http://bamboo.ssdt-ohio.org/browse/${gradle.bambooPlan}" |
26 property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}" | 26 property "sonar.scm.url", "scm:hg:${gradle.hgRepositoryUrl}" |
27 } | 27 } |
28 } | 28 } |
29 | 29 |
30 //gradle.rootProject.afterEvaluate { project -> | 30 if (gradle.environment.coverage) { |
31 // | |
32 // project.jacocoTestReport { | |
33 // | |
34 // | |
35 // } | |
36 // | |
37 //} | |
38 | 31 |
32 configurations { | |
33 jacocoAntRoot | |
34 } | |
35 dependencies { | |
36 jacocoAntRoot 'org.jacoco:org.jacoco.ant:0.6.2.201302030002' | |
37 } | |
39 | 38 |
39 task fullCoverageReport << { | |
40 ant { | |
41 taskdef(name:'jacocoreport', classname: 'org.jacoco.ant.ReportTask', classpath: configurations.jacocoAntRoot.asPath) | |
42 | |
43 mkdir dir: "${buildDir.path}/reports/coverage" | |
44 | |
45 jacocoreport { | |
46 executiondata { | |
47 fileset(dir: "${buildDir.path}/coverage-results") { | |
48 include name: '*.jacoco.exec' | |
49 } | |
50 } | |
51 | |
52 structure(name: project.name) { | |
53 | |
54 classfiles { | |
55 subprojects.each { project -> | |
56 fileset dir: project.sourceSets.main.output.classesDir | |
57 } | |
58 } | |
59 sourcefiles(encoding: 'CP1252') { | |
60 subprojects.each { project -> | |
61 project.sourceSets.main.allGroovy.srcDirs.findAll { file(it).exists() } each { | |
62 fileset dir: "$it" | |
63 } | |
64 } | |
65 } | |
66 } | |
67 | |
68 xml destfile: "${buildDir.path}/reports/coverage/jacoco.xml" | |
69 html destdir: "${buildDir.path}/reports/coverage" | |
70 } | |
71 } | |
72 } | |
73 | |
74 fullCoverageReport.dependsOn { | |
75 subprojects.collect { project -> | |
76 project.copyCoverageData.path | |
77 } | |
78 } | |
79 | |
80 } | |
40 | 81 |
41 subprojects { | 82 subprojects { |
42 afterEvaluate { project -> | 83 afterEvaluate { project -> |
43 | 84 |
44 def groovyProject = project.plugins.hasPlugin('groovy') | 85 def groovyProject = project.plugins.hasPlugin('groovy') |
71 | 112 |
72 task coverageReport { | 113 task coverageReport { |
73 dependsOn jacocoTestReport | 114 dependsOn jacocoTestReport |
74 } | 115 } |
75 | 116 |
117 task copyCoverageData(dependsOn: test, type: Copy) { | |
118 from project.test.jacoco.destPath | |
119 into "${rootProject.buildDir.path}/coverage-results" | |
120 include 'test.exec' | |
121 rename 'test.exec', "${project.name}.jacoco.exec" | |
122 } | |
123 | |
76 } | 124 } |
77 | 125 |
78 sonarRunner { | 126 sonarRunner { |
79 sonarProperties { | 127 sonarProperties { |
80 property "sonar.language", groovyProject ? 'grvy' : 'java' | 128 property "sonar.language", groovyProject ? 'grvy' : 'java' |