-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
66 lines (58 loc) · 1.81 KB
/
build.gradle.kts
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
54
55
56
57
58
59
60
61
62
63
64
65
66
import com.autonomousapps.tasks.BuildHealthTask
import org.orkg.gradle.plugins.PrintCoverageTask
plugins {
id("org.orkg.gradle.root")
base // required, otherwise report aggregation plugins will not work
id("test-report-aggregation")
id("jacoco-report-aggregation")
id("org.orkg.gradle.print-coverage")
}
dependencies {
// Configure all projects for test and coverage aggregation. Ignore parent projects, or those without (tested) code.
val parentProjects = subprojects
.map(Project::getPath)
.filter { path -> path.count { it == ':' } < 2 }
.filterNot { it == ":rest-api-server" } // Not a parent project
.toSet()
val ignoredProjects = setOf(":platform", ":testing:kotest", ":testing:spring") union parentProjects
subprojects
.filterNot { it.path in ignoredProjects }
.onEach(::jacocoAggregation)
.onEach(::testReportAggregation)
}
// Test reports
reporting {
reports {
val testAggregateTestReport by creating(AggregateTestReport::class) {
testType.set(TestSuiteType.UNIT_TEST)
}
}
}
// JaCoCo Code Coverage Report
reporting {
reports {
val testCodeCoverageReport by registering(JacocoCoverageReport::class) {
testType.set(TestSuiteType.UNIT_TEST)
}
}
}
val testCodeCoverageReport by tasks.getting(JacocoReport::class) {
reports {
xml.required.set(true)
}
}
dependencyAnalysis {
issues {
all {
onAny {
severity("fail")
}
}
}
}
tasks.check {
dependsOn(tasks.named<TestReport>("testAggregateTestReport"))
dependsOn(tasks.named<JacocoReport>("testCodeCoverageReport"))
dependsOn(tasks.named<BuildHealthTask>("buildHealth"))
finalizedBy(tasks.named<PrintCoverageTask>("printCoverage"))
}