-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
107 lines (88 loc) · 2.7 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
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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.sonarqube.gradle.SonarExtension
import org.sonarqube.gradle.SonarTask
plugins {
id("jacoco-report-aggregation")
id("java-library")
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.sonarqube.plugin)
}
dependencies {
rootProject.subprojects.forEach { subproject ->
jacocoAggregation(subproject)
}
}
configure<SonarExtension> {
properties {
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.projectKey", "de.havox_design.aoc:advent_of_code")
property("sonar.organization", "havox")
property("sonar.sourceEncoding", "UTF-8")
}
}
if (tasks.findByName("check") == null) {
tasks.register("check") {
group = "verification"
description = "Collector task for check tasks..."
}
}
tasks.named("check") {
dependsOn(tasks.named("testCodeCoverageReport"))
}
// Switch to gradle "all" distribution.
tasks.withType<Wrapper> {
distributionType = Wrapper.DistributionType.ALL
gradleVersion = "8.14"
}
develocity {
buildScan {
termsOfUseUrl.set("https://gradle.com/help/legal-terms-of-use")
termsOfUseAgree.set("yes")
}
}
rootProject.allprojects.forEach { currentProject ->
currentProject.apply(plugin = "jacoco")
currentProject.apply(plugin = "java-library")
currentProject.repositories {
mavenCentral()
}
currentProject.dependencies {
testImplementation(libs.hamcrest)
testImplementation(libs.junit.jupiter)
}
currentProject.jacoco {
toolVersion = "0.8.13"
}
val jacocoTestReportTask = currentProject.tasks.named<JacocoReport>("jacocoTestReport") {
reports {
html.required.set(true)
xml.required.set(true)
}
}
currentProject.tasks.named("check") {
dependsOn(jacocoTestReportTask)
}
rootProject.tasks.withType<SonarTask> {
dependsOn(jacocoTestReportTask)
}
currentProject.configure<SonarExtension> {
properties {
property(
"sonar.coverage.jacoco.xmlReportPaths",
"${rootProject.layout.buildDirectory.get().asFile.absolutePath}/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml"
)
}
}
currentProject.tasks.withType<Test> {
useJUnitPlatform()
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
testLogging {
exceptionFormat = TestExceptionFormat.FULL
events("passed", "failed", "skipped")
}
reports {
junitXml.required = true
html.required = true
}
}
}