mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 16:49:11 +00:00
72 lines
2.0 KiB
Groovy
72 lines
2.0 KiB
Groovy
apply plugin: "jacoco"
|
|
|
|
def jacocoCoverageAggregate = "$buildDir/jacoco/jacocoTestAll.exec"
|
|
|
|
def testedProjects() {
|
|
subprojects.findAll { subproject -> subproject.plugins.hasPlugin('java') || subproject.plugins.hasPlugin('kotlin') }
|
|
}
|
|
gradle.projectsEvaluated {
|
|
configure(testedProjects()) {
|
|
apply plugin: "jacoco"
|
|
|
|
jacoco {
|
|
toolVersion = '0.8.4'
|
|
}
|
|
|
|
test {
|
|
reports {
|
|
junitXml.enabled = true
|
|
html.enabled = false
|
|
}
|
|
|
|
jacoco {
|
|
append = false
|
|
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
|
|
classDumpDir = file("$buildDir/jacoco/classpathdumps")
|
|
}
|
|
}
|
|
}
|
|
|
|
task jacocoMerge(type: JacocoMerge) {
|
|
destinationFile = file(jacocoCoverageAggregate)
|
|
executionData = project.fileTree(dir: '.', include: '**/build/jacoco/jacocoTest.exec')
|
|
|
|
dependsOn(getTasksByName('test', true))
|
|
}
|
|
|
|
|
|
task jacocoReport(type: JacocoReport) {
|
|
sourceDirectories.setFrom(files())
|
|
classDirectories.setFrom(files())
|
|
executionData.setFrom(files())
|
|
|
|
reports {
|
|
html.enabled = true
|
|
xml.enabled = true
|
|
csv.enabled = false
|
|
}
|
|
|
|
// Work-around to allow us to build list of executionData files in doFirst
|
|
onlyIf = {
|
|
true
|
|
}
|
|
|
|
/*
|
|
* Builds list of source dirs, class dirs, and executionData files
|
|
* when task is run, not at script evaluation time
|
|
*/
|
|
doFirst {
|
|
subprojects.findAll { subproject ->
|
|
subproject.pluginManager.hasPlugin('java') || subproject.pluginManager.hasPlugin('kotlin')
|
|
}.each { subproject ->
|
|
additionalSourceDirs files((Set<File>) subproject.sourceSets.main.allSource.srcDirs)
|
|
additionalClassDirs((FileCollection) subproject.sourceSets.main.output)
|
|
}
|
|
|
|
executionData.setFrom(files(jacocoCoverageAggregate))
|
|
}
|
|
|
|
dependsOn(jacocoMerge)
|
|
}
|
|
}
|