forked from cloudfoundry-community/autosleep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoverage.gradle
54 lines (45 loc) · 2.57 KB
/
coverage.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
apply plugin: 'jacoco'
apply plugin: "com.github.kt3k.coveralls"
def analysableProjects = subprojects.findAll { it.name != 'spring-apps' && it.name != 'acceptance' }
task jacocoRootReport(type: JacocoReport, group: 'Coverage reports') {
description = 'Generates an aggregate report from all subprojects'
dependsOn(analysableProjects.test)
additionalSourceDirs = files(analysableProjects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(analysableProjects.sourceSets.main.allSource.srcDirs)
classDirectories = files(analysableProjects.sourceSets.main.output)
executionData = files(analysableProjects.jacocoTestReport.executionData)
reports {
html.enabled = true // human readable
xml.enabled = true // required by coveralls
}
onlyIf = {
/* jacocoRootReport doesn't work if some subprojects don't have any tests
* at all because this causes the onlyIf of JacocoReport to be false. */
true
}
doFirst {
executionData = files(executionData.findAll { it.exists() })
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it,
exclude: ['org/cloudfoundry/autosleep/access/cloudfoundry/model/**', //won't test pojo
'org/cloudfoundry/autosleep/access/cloudfoundry/config/**', //won't test config
'org/cloudfoundry/autosleep/util/**',
'org/cloudfoundry/autosleep/util/serializer/**',
'org/cloudfoundry/autosleep/access/dao/model/**', //won't test pojo
'org/cloudfoundry/autosleep/access/dao/config/data/RelationalCloudDataSourceConfig.class', //cloud config
'org/cloudfoundry/autosleep/config/ContextInitializer.class', //won't test cloud context init
'org/cloudfoundry/autosleep/Application.class', //skip main
'org/cloudfoundry/autosleep/WakeUpApplication.class', //skip main
'org/cloudfoundry/autosleep/ui/security/SecurityManager.class',
'org/cloudfoundry/autosleep/ui/proxy/HttpClientConfiguration.class',
'org/cloudfoundry/autosleep/ui/proxy/ProxyController.class' //not implemented for now
])
})
}
}
coveralls {
sourceDirs = analysableProjects.sourceSets.main.allSource.srcDirs.flatten()
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
}