This repository has been archived by the owner on Dec 22, 2024. It is now read-only.
generated from siyul-park/kotlin-multi-module-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
199 lines (163 loc) · 7.49 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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
val kotlin_version: String by project
val junit_version: String by project
val mockk_version: String by project
val jacoco_version: String by project
val coroutines_version: String by project
val projectreactor_version: String by project
val reactor_kotlin_extensions_version: String by project
val guava_version: String by project
val apache_commons_collections_version: String by project
val apache_commons_validator_version: String by project
val jackson_version: String by project
val json_patch_version: String by project
val springdoc_version: String by project
val sentry_logback_version: String by project
val embed_mongo_version: String by project
val datafaker_version: String by project
val redisson_version: String by project
val embedded_redis_version: String by project
buildscript {
val kotlin_version: String by project
val ktlint_version: String by project
repositories {
maven { url = uri("https://plugins.gradle.org/m2/") }
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-allopen:$kotlin_version")
classpath("org.jetbrains.kotlin:kotlin-noarg:$kotlin_version")
classpath("org.jlleitschuh.gradle:ktlint-gradle:$ktlint_version")
}
}
plugins {
application
kotlin("jvm")
id("org.jlleitschuh.gradle.ktlint")
id("jacoco")
id("org.springframework.boot")
id("io.spring.dependency-management")
kotlin("plugin.spring")
}
jacoco {
toolVersion = jacoco_version
}
tasks {
bootJar {
enabled = false
}
jar {
enabled = true
}
}
group = "io.github.siyual-park"
version = "0.0.0-SNAPSHOT"
allprojects {
apply(plugin = "kotlin")
apply(plugin = "org.jlleitschuh.gradle.ktlint")
apply(plugin = "jacoco")
apply(plugin = "org.springframework.boot")
apply(plugin = "io.spring.dependency-management")
apply(plugin = "org.jetbrains.kotlin.plugin.spring")
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib"))
implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$coroutines_version")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactive:$coroutines_version")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutines_version")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junit_version")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junit_version")
testImplementation("io.mockk:mockk:$mockk_version")
implementation("io.sentry:sentry-logback:$sentry_logback_version")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-validation")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
testImplementation("org.springframework.boot:spring-boot-starter-test")
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions:$reactor_kotlin_extensions_version")
implementation("org.springframework.boot:spring-boot-starter-data-r2dbc")
implementation("org.springframework.boot:spring-boot-starter-data-mongodb-reactive")
implementation("io.r2dbc:r2dbc-h2")
implementation("io.r2dbc:r2dbc-pool")
implementation("org.postgresql:r2dbc-postgresql")
runtimeOnly("com.h2database:h2")
implementation("de.flapdoodle.embed:de.flapdoodle.embed.mongo:$embed_mongo_version")
testImplementation("io.projectreactor:reactor-test:$projectreactor_version")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version")
implementation("com.google.guava:guava:$guava_version")
implementation("org.apache.commons:commons-collections4:$apache_commons_collections_version")
implementation("commons-validator:commons-validator:$apache_commons_validator_version")
implementation("com.fasterxml.jackson.core:jackson-core:$jackson_version")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version")
implementation("com.github.java-json-tools:json-patch:$json_patch_version")
implementation("org.springdoc:springdoc-openapi-ui:$springdoc_version")
implementation("org.springdoc:springdoc-openapi-webflux-ui:$springdoc_version")
implementation("org.springdoc:springdoc-openapi-security:$springdoc_version")
implementation("org.springdoc:springdoc-openapi-kotlin:$springdoc_version")
implementation("net.datafaker:datafaker:$datafaker_version")
implementation("org.redisson:redisson-spring-boot-starter:$redisson_version")
implementation("it.ozimov:embedded-redis:$embedded_redis_version") {
exclude("org.slf4j")
exclude("ch.qos.logback")
}
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
tasks.withType<Copy> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().all {
kotlinOptions {
freeCompilerArgs = listOf(
"-Xjsr305=strict",
"-Xemit-jvm-type-annotations"
)
jvmTarget = JavaVersion.VERSION_11.toString()
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
}
// task to gather code coverage from multiple subprojects
// NOTE: the `JacocoReport` tasks do *not* depend on the `test` task by default. Meaning you have to ensure
// that `test` (or other tasks generating code coverage) run before generating the report.
// You can achieve this by calling the `test` lifecycle task manually
// $ ./gradlew test codeCoverageReport
tasks.register<JacocoReport>("codeCoverageReport") {
// If a subproject applies the 'jacoco' plugin, add the result it to the report
subprojects {
val subproject = this
subproject.plugins.withType<JacocoPlugin>().configureEach {
subproject.tasks.matching { it.extensions.findByType<JacocoTaskExtension>() != null }.configureEach {
val testTask = this
sourceSets(subproject.sourceSets.main.get())
executionData(testTask)
}
// To automatically run `test` every time `./gradlew codeCoverageReport` is called,
// you may want to set up a task dependency between them as shown below.
// Note that this requires the `test` tasks to be resolved eagerly (see `forEach`) which
// may have a negative effect on the configuration time of your build.
subproject.tasks.matching { it.extensions.findByType<JacocoTaskExtension>() != null }.forEach {
rootProject.tasks["codeCoverageReport"].dependsOn(it)
}
}
}
// enable the different report types (html, xml, csv)
reports {
// xml is usually used to integrate code coverage with
// other tools like SonarQube, Coveralls or Codecov
xml.required.set(true)
// HTML reports can be used to see code coverage
// without any external tools
html.required.set(true)
}
}