-
Notifications
You must be signed in to change notification settings - Fork 117
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
executable file
·156 lines (130 loc) · 4.14 KB
/
build.gradle.kts
File metadata and controls
executable file
·156 lines (130 loc) · 4.14 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jmailen.gradle.kotlinter.tasks.LintTask
import org.springframework.boot.gradle.tasks.bundling.BootJar
import pl.allegro.tech.build.axion.release.domain.TagNameSerializationConfig
import pl.allegro.tech.build.axion.release.domain.hooks.HooksConfig
plugins {
`maven-publish`
id("io.github.gradle-nexus.publish-plugin") version "1.0.0"
id("org.jmailen.kotlinter") version "5.2.0" apply false
id("org.sonarqube") version "7.0.1.6134"
id("pl.allegro.tech.build.axion-release") version "1.21.0"
jacoco
java
kotlin("jvm") version "2.2.21" apply false
id("org.springframework.boot") version "4.0.1"
}
repositories {
mavenCentral()
}
scmVersion {
tag {
prefix.set("")
}
hooks {
pre(
"fileUpdate",
mapOf(
"file" to "README.md",
"pattern" to "{v,p -> /('$'v)/}",
"replacement" to """{v, p -> "'$'v"}]))""",
),
)
pre("commit")
}
}
val scmVer = scmVersion.version
fun Project.isSampleProject() = this.name.contains("sample")
val nonSampleProjects = subprojects.filterNot { it.isSampleProject() }
allprojects {
group = "com.epages"
version = scmVer
if (!isSampleProject()) {
apply(plugin = "java")
apply(plugin = "kotlin")
apply(plugin = "jacoco")
apply(plugin = "maven-publish")
apply(plugin = "org.jmailen.kotlinter")
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
}
}
subprojects {
val jmustacheVersion by extra { "1.16" }
tasks.withType<KotlinCompile> {
compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
if (!isSampleProject()) {
tasks.withType<JacocoReport> {
dependsOn("test")
reports {
html.required.set(false)
xml.required.set(false)
}
}
tasks.withType<JavaCompile> {
targetCompatibility = "21"
sourceCompatibility = "21"
}
}
}
tasks {
val jacocoTestReport = this.getByName("jacocoTestReport")
jacocoTestReport.dependsOn(nonSampleProjects.map { it.tasks["jacocoTestReport"] })
val jacocoRootReport by registering(JacocoReport::class) {
description = "Generates an aggregate report from all subprojects"
group = "Coverage reports"
sourceDirectories.setFrom(
files(
nonSampleProjects.flatMap {
it.sourceSets["main"].allSource.srcDirs.filter {
it.exists() &&
!it.path.endsWith("restdocs-api-spec-postman-generator/src/main/java")
}
},
),
)
classDirectories.setFrom(
files(
nonSampleProjects
.flatMap {
it.sourceSets["main"].output
}.filter { !it.path.endsWith("restdocs-api-spec-postman-generator/build/classes/java/main") },
),
)
executionData(files(nonSampleProjects.map { it.layout.buildDirectory.file("jacoco/test.exec") }))
reports {
html.required.set(false)
xml.required.set(false)
}
}
getByName("sonar").dependsOn(jacocoRootReport)
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
}
}
}
sonar {
properties {
property("sonar.projectKey", "ePages-de_restdocs-api-spec")
property("sonar.organization", "epages-de")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.exclusions", "**/samples/**")
}
}
tasks.withType<BootJar> {
enabled = false
}