-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle.kts
116 lines (101 loc) · 4.01 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
108
109
110
111
112
113
114
115
116
import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension
import io.spring.gradle.dependencymanagement.dsl.ImportsHandler
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.openapi.generator") version "7.9.0"
id("com.github.jk1.dependency-license-report") version "2.9"
id("org.springframework.boot") version "3.1.8"
id("com.diffplug.spotless") version "6.25.0"
kotlin("jvm") version "1.9.25"
kotlin("plugin.spring") version "1.9.25"
}
apply(plugin = "io.spring.dependency-management")
apply { from("../gradle/jacoco.gradle") }
apply { from("../gradle/licenses.gradle") }
group = "de.codecentric.hc"
java.sourceCompatibility = JavaVersion.VERSION_17
configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}
sourceSets {
main {
java {
srcDir("$rootDir/src/main/kotlin")
srcDir("$buildDir/generated-sources/src/main/kotlin")
}
}
test {
java {
srcDir("$rootDir/src/test/kotlin")
}
}
}
repositories {
mavenCentral()
}
extra["chaosMonkeyVersion"] = "3.1.2"
extra["mockkVersion"] = "1.13.16"
extra["springMockkVersion"] = "4.0.2"
extra["wiremockVersion"] = "3.0.1"
extra["moschiVersion"] = "1.15.2"
dependencies {
implementation("io.swagger.core.v3:swagger-annotations:2.2.27")
implementation("com.squareup.moshi:moshi:${property("moschiVersion")}")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("io.micrometer:micrometer-tracing-bridge-otel")
implementation("io.opentelemetry:opentelemetry-exporter-zipkin")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
runtimeOnly("de.codecentric:chaos-monkey-spring-boot:${property("chaosMonkeyVersion")}")
runtimeOnly("org.aspectj:aspectjweaver")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
exclude(module = "mockito-core")
}
testImplementation("io.projectreactor:reactor-test")
testImplementation("io.mockk:mockk:${property("mockkVersion")}")
testImplementation("com.ninja-squad:springmockk:${property("springMockkVersion")}")
testImplementation("com.github.tomakehurst:wiremock:${property("wiremockVersion")}")
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.withType<KotlinCompile> {
dependsOn(tasks.openApiGenerate)
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "17"
}
}
openApiGenerate {
inputSpec.set("$rootDir/openapi.yaml")
generatorName.set("kotlin-spring")
validateSpec.set(true)
apiPackage.set("de.codecentric.hc.report.api")
modelPackage.set("de.codecentric.hc.report.api.model")
outputDir.set("$buildDir/generated-sources")
library.set("spring-boot")
configOptions.put("basePackage", "de.codecentric.hc.report")
configOptions.put("interfaceOnly", "true")
configOptions.put("useSpringBoot3", "true")
configOptions.put("documentationProvider", "none")
}
tasks.named("openApiGenerate") {
doLast {
// OpenAPI generator plugin for Kotlin Spring generates a useless application class
File("$buildDir/generated-sources/src/main/kotlin/de/codecentric/hc/report/Application.kt").delete()
}
}
// disable the jar task to prevent the plain jar from being created.
tasks.named<Jar>("jar") {
enabled = false
}