-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathbuild.gradle
More file actions
115 lines (97 loc) · 4.19 KB
/
Copy pathbuild.gradle
File metadata and controls
115 lines (97 loc) · 4.19 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
plugins {
id("com.github.spotbugs") version "6.1.10"
}
apply plugin: 'jacoco'
// All JaCoCo exclusions for the aggregate report, centralised here.
// Per-module jacocoTestReport exclusions don't reliably propagate to the aggregate
// task because of Gradle's configuration resolution order, so all exclusions are
// declared once and applied when building filtered FileTrees below.
ext.jacocoAggregateExcludes = [
// ── hoptimator-models / hoptimator-k8s ──────────────────────────────────────
'**/models/**', // auto-generated K8s CRD model classes
// ── hoptimator-flink-runner ──────────────────────────────────────────────────
'**/FlinkRunner.class', // CLI entry point; requires Flink runtime
// ── hoptimator-cli ───────────────────────────────────────────────────────────
'sqlline/**', // third-party library bundled via application
// ── hoptimator-jdbc ──────────────────────────────────────────────────────────
'**/ddl/**', // auto-generated JavaCC SQL parser
]
task jacocoAggregateReport(type: JacocoReport) {
group = 'verification'
description = 'Generates an aggregate JaCoCo coverage report across all subprojects.'
reports {
html.required = true
xml.required = true
html.outputLocation = layout.buildDirectory.dir('reports/jacoco/aggregate')
xml.outputLocation = layout.buildDirectory.file('reports/jacoco/aggregate/jacocoAggregateReport.xml')
}
}
subprojects {
plugins.withType(JacocoPlugin).configureEach {
rootProject.jacocoAggregateReport.dependsOn(test)
rootProject.jacocoAggregateReport.executionData(test)
rootProject.jacocoAggregateReport.sourceDirectories.from(sourceSets.main.allSource.srcDirs)
// Add a filtered FileTree for each classes directory. Using fileTree directly (rather than
// jacocoTestReport.classDirectories) ensures the exclusions are applied at resolution time,
// bypassing Gradle's configuration-resolution ordering issue with per-module setFrom().
def excludes = rootProject.ext.jacocoAggregateExcludes
sourceSets.main.output.classesDirs.each { classesDir ->
rootProject.jacocoAggregateReport.classDirectories.from(
fileTree(dir: classesDir, excludes: excludes)
)
}
}
}
subprojects {
apply plugin: 'checkstyle'
apply plugin: 'com.github.spotbugs'
tasks.withType(JavaCompile).configureEach {
options.release = 11
options.compilerArgs << '-Xlint:deprecation'
options.compilerArgs << '-Xlint:unchecked'
}
tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:none', '-quiet')
}
spotbugs {
ignoreFailures = false
showProgress = true
reportsDir = file("${rootDir}/build/spotbugs")
includeFilter = file("$rootDir/config/spotbugs/include.xml")
excludeFilter = file("$rootDir/config/spotbugs/exclude.xml")
}
plugins.withType(JavaPlugin) {
project.apply plugin: 'jacoco'
jacoco {
toolVersion = "0.8.11"
}
dependencies {
testImplementation libs.assertj
testImplementation libs.junit.jupiter.api
testImplementation libs.junit.jupiter.params
testImplementation libs.junit.platform.launcher
testImplementation libs.mockito.inline
testImplementation libs.mockito.junit.jupiter
testRuntimeOnly libs.junit.jupiter.engine
}
test {
useJUnitPlatform {
excludeTags 'integration'
}
testLogging {
events "passed", "skipped", "failed"
}
}
tasks.register('intTest', Test) {
description = 'Runs integration tests.'
group = 'verification'
shouldRunAfter test
useJUnitPlatform {
includeTags 'integration'
}
testLogging {
events "passed", "skipped", "failed"
}
}
}
}