-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
129 lines (108 loc) · 3.63 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
129 lines (108 loc) · 3.63 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
plugins {
application
alias(libs.plugins.kotlin.jvm)
jacoco
alias(libs.plugins.sonarqube)
alias(libs.plugins.plugin.serialization)
alias(libs.plugins.ktor.plugin)
}
group = "es.wokis"
version = "1.0"
application {
mainClass.set("es.wokis.ApplicationKt")
val isDevelopment: Boolean = project.ext.has("development")
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
}
repositories {
mavenCentral()
}
dependencies {
// Ktor Server
implementation(libs.ktor.server.content.negotiation)
implementation(libs.ktor.server.core)
implementation(libs.ktor.serialization.kotlinx.json)
implementation(libs.ktor.server.call.logging)
implementation(libs.ktor.server.cors)
implementation(libs.ktor.server.auth)
implementation(libs.ktor.server.auth.jwt)
implementation(libs.ktor.server.netty)
implementation(libs.ktor.server.rate.limit)
implementation(libs.ktor.server.metrics)
implementation(libs.ktor.server.metrics.micrometer)
// Ktor Client
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.cio)
implementation(libs.ktor.client.logging)
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.client.serialization.kotlin.json)
implementation(libs.ktor.client.client.resources)
implementation(libs.ktor.client.client.auth)
// Prometheus
implementation(libs.micrometer.registry.prometheus)
// Mongodb
implementation(libs.mongobd)
// Koin
implementation(libs.koin.ktor)
implementation(libs.koin.logger.slf4j)
// Bcrypt
implementation(libs.jbcrypt)
// JavaMail
implementation(libs.javax.mail.api)
implementation(libs.javax.mail)
// TOTP
implementation(libs.kotlin.onetimepassword)
// Commons codec
implementation(libs.commons.codec)
// Logs
implementation(libs.slf4j.api)
implementation(libs.slf4j.simple)
// Tests
testImplementation(libs.ktor.server.tests)
testImplementation(libs.kotlin.test.junit)
testImplementation(libs.ktor.client.mock)
}
val shadowJarTask = tasks.named("shadowJar")
tasks.named("distZip") { dependsOn(shadowJarTask) }
tasks.named("distTar") { dependsOn(shadowJarTask) }
tasks.named("startScripts") { dependsOn(shadowJarTask) }
tasks.named("startShadowScripts") { dependsOn(tasks.named("jar")) }
ktor {
fatJar {
archiveFileName.set("${rootProject.name}-${rootProject.version}.jar")
}
}
tasks.test {
useJUnitPlatform()
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
}
jacoco {
toolVersion = libs.versions.jacoco.get()
reportsDirectory = layout.buildDirectory.dir("customJacocoReportDir")
}
tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report
reports {
xml.required = true
xml.outputLocation.set(file("build/reports/jacoco/test-results/jacocoTestReport.xml"))
csv.required = false
html.outputLocation = layout.buildDirectory.dir("jacocoHtml")
}
}
sonar {
properties {
val projectKey = System.getenv("SONAR_PROJECT_KEY")
val organization = System.getenv("SONAR_ORGANIZATION")
val exclusions = listOf(
"**/*BO.kt",
"**/*DTO.kt",
"**/*Exception.kt",
"src/main/kotlin/es/wokis/Application.kt",
"*.kts",
"**/di/*.kt",
)
property("sonar.projectKey", projectKey)
property("sonar.organization", organization)
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.coverage.exclusions", exclusions)
}
}