-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
258 lines (224 loc) · 9.1 KB
/
build.gradle.kts
File metadata and controls
258 lines (224 loc) · 9.1 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
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
val kotestAssertionsVersion: String by properties
val kotlinVersion: String by properties
val flywayVersion: String by properties
val log4jApiKotlinVersion: String by properties
val jsonVersion: String by properties
val junitVersion: String by properties
val mockkVersion: String by properties
val testContainersVersion: String by properties
val okhttp3Version: String by properties
val kotlinxCoroutinesCoreVersion: String by properties
val springCloudContractWiremockVersion: String by properties
val springDocOpenApiVersion: String by properties
plugins {
id("org.springframework.boot")
id("io.spring.dependency-management")
kotlin("jvm")
kotlin("plugin.spring")
kotlin("plugin.jpa")
id("org.jetbrains.kotlin.plugin.allopen")
jacoco
id("org.sonarqube") version "6.2.0.5505"
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
kotlin {
jvmToolchain(17)
}
allOpen {
annotation("javax.persistence.Entity")
annotation("javax.persistence.MappedSuperclass")
annotation("javax.persistence.Embeddable")
}
repositories {
mavenCentral()
}
dependencyManagement {
imports {
mavenBom("software.amazon.awssdk:bom:2.17.198")
}
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-batch")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-cache")
implementation("com.github.ben-manes.caffeine:caffeine:3.1.8")
testImplementation("org.springframework.security:spring-security-test")
developmentOnly("org.springframework.boot:spring-boot-devtools")
implementation("org.postgresql:postgresql")
implementation("org.flywaydb:flyway-core:$flywayVersion")
implementation("com.google.firebase:firebase-admin:8.1.0")
implementation("com.auth0:java-jwt:3.10.3")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-csv")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesCoreVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactive:$kotlinxCoroutinesCoreVersion")
implementation("org.apache.logging.log4j:log4j-api-kotlin:$log4jApiKotlinVersion")
implementation("org.springdoc:springdoc-openapi-ui:$springDocOpenApiVersion")
implementation("org.springdoc:springdoc-openapi-kotlin:$springDocOpenApiVersion")
implementation("software.amazon.awssdk:s3")
implementation("com.google.cloud:google-cloud-storage:1.110.0")
implementation("org.json:json:$jsonVersion")
implementation("commons-io:commons-io:2.17.0")
testImplementation("org.springframework.boot:spring-boot-starter-webflux")
testImplementation("org.springframework.cloud:spring-cloud-contract-wiremock:$springCloudContractWiremockVersion")
testImplementation("org.amshove.kluent:kluent:1.68") // should be deleted after kotest move all of it
testImplementation("org.jetbrains.kotlin:kotlin-test:1.3.72") // should be deleted after kotest move all of it
testImplementation("io.kotest:kotest-assertions-core:$kotestAssertionsVersion")
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude("junit")
}
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testImplementation("io.mockk:mockk:$mockkVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
testImplementation("org.junit.jupiter:junit-jupiter-params:$junitVersion")
testImplementation("org.testcontainers:testcontainers")
testImplementation("com.natpryce:hamkrest:1.8.0.1")
testImplementation("org.testcontainers:junit-jupiter:$testContainersVersion")
testImplementation("org.testcontainers:postgresql:$testContainersVersion")
testImplementation("org.testcontainers:localstack:$testContainersVersion")
testImplementation("com.amazonaws:aws-java-sdk:1.11.808")
testImplementation("com.squareup.okhttp3:okhttp:$okhttp3Version")
testImplementation("com.squareup.okhttp3:mockwebserver:$okhttp3Version")
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "17"
}
}
// --- ktlint - kotlin code style plugin ---
val ktlint by configurations.creating
configurations {
ktlint
}
dependencies {
ktlint("com.pinterest.ktlint:ktlint-cli:1.5.0") {
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))
}
}
// ktlint(project(":custom-ktlint-ruleset")) // in case of custom ruleset
}
val ktlintCheck by tasks.registering(JavaExec::class) {
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = "Check Kotlin code style"
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
// see https://pinterest.github.io/ktlint/install/cli/#command-line-usage for more information
args(
"**/src/**/*.kt",
"**.kts",
"!**/build/**",
)
}
tasks.check {
dependsOn(ktlintCheck)
}
tasks.register<JavaExec>("ktlintFormat") {
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = "Check Kotlin code style and format"
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
// see https://pinterest.github.io/ktlint/install/cli/#command-line-usage for more information
args(
"-F",
"**/src/**/*.kt",
"**.kts",
"!**/build/**",
)
}
project.exec {
commandLine = "git config core.hooksPath .githooks".split(" ")
}
tasks.named("compileKotlin") { dependsOn("ktlintCheck") }
tasks.withType<Test>().configureEach {
javaLauncher.set(
javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(17))
},
)
useJUnitPlatform {
excludeTags("integration-test")
}
}
tasks.test {
finalizedBy("jacocoTestReport")
}
tasks.withType<JacocoReport> {
dependsOn("test")
reports {
xml.required.set(true)
html.required.set(true)
xml.outputLocation.set(file("$buildDir/jacoco/coverage.xml"))
csv.required.set(false)
html.outputLocation.set(file("$buildDir/jacoco/html"))
}
afterEvaluate {
classDirectories.setFrom(
files(
classDirectories.files.map {
fileTree(it).apply {
exclude(
"com/epam/brn/dto/**",
"com/epam/brn/model/**",
"com/epam/brn/config/**",
"com/epam/brn/exception/**",
"com/epam/brn/Application*",
"com/epam/brn/service/azure/tts/config/**",
"com/epam/brn/webclient/customizer/**",
"com/epam/brn/webclient/model/**",
)
}
},
),
)
}
executionData.setFrom("$buildDir/jacoco/test.exec")
}
task<Test>("integrationTest") {
useJUnitPlatform { includeTags("integration-test") }
mustRunAfter(tasks["test"])
group = "Verification"
description = "Runs the integration tests on Postgres Test Container."
}
sonarqube {
properties {
// Root project information
property("sonar.projectKey", "Brain-up_brn")
property("sonar.organization", "brain-up")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.coverage.jacoco.xmlReportPaths", "./build/jacoco/coverage.xml")
property("sonar.language", "kotlin")
property("sonar.java.coveragePlugin", "jacoco")
property("sonar.working.directory", "./build/sonar")
property(
"sonar.coverage.exclusions",
"**/com/epam/brn/dto/**," +
"**/com/epam/brn/model/**," +
"**/com/epam/brn/config/**," +
"**/com/epam/brn/exception/**," +
"**/com/epam/brn/Application*," +
"**/com/epam/brn/service/load/InitialDataLoader*," +
"**/com/epam/brn/service/load/FirebaseUserDataLoader*," +
"**/com/epam/brn/service/azure/tts/AzureVoiceLoader*," +
"**/com/epam/brn/service/azure/tts/config/**," +
"**/com/epam/brn/webclient/customizer/**," +
"**/com/epam/brn/webclient/model/**",
)
}
}