Enable caching for Test tasks

This commit is contained in:
Lóránt Pintér 2018-02-01 11:56:23 +01:00 committed by Rob Winch
parent f7beb537f0
commit 7b708bb4f5
1 changed files with 13 additions and 0 deletions

View File

@ -17,3 +17,16 @@ ext.releaseBuild = version.contains("SNAPSHOT")
ext.milestoneBuild = !(snapshotBuild || releaseBuild)
dependencyManagementExport.projects = subprojects.findAll { !it.name.contains('-boot') }
// Disable JaCoCo when not explicitly requested to enable caching of test
// See https://discuss.gradle.org/t/do-not-cache-if-condition-matched-jacoco-agent-configured-with-append-true-satisfied/23504
gradle.taskGraph.whenReady { graph ->
def enabled = graph.allTasks.any { it instanceof JacocoReport }
subprojects { project ->
project.plugins.withType(JacocoPlugin) {
project.tasks.withType(Test) {
jacoco.enabled = enabled
}
}
}
}