-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
174 lines (143 loc) · 5.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
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import java.io.ByteArrayOutputStream
group = "no.nav.syfo"
version = "1.0.0"
val javaVersion = JvmTarget.JVM_21
val caffeineVersion = "3.1.8"
val coroutinesVersion = "1.9.0"
val jacksonVersion = "2.18.0"
val kluentVersion = "1.73"
val ktorVersion = "3.0.1"
val logbackVersion = "1.5.8"
val logstashEncoderVersion = "8.0"
val prometheusVersion = "0.16.0"
val kotestVersion = "5.9.1"
val mockkVersion = "1.13.12"
val kotlinVersion = "2.0.20"
val ktfmtVersion = "0.44"
val diagnosekoderVersion = "1.2024.0"
val kafkaVersion = "3.8.0"
///Due to vulnerabilities
val nettyCommonVersion = "4.1.115.Final"
val snappyJavaVersion = "1.1.10.7"
plugins {
id("application")
kotlin("jvm") version "2.0.20"
id("com.diffplug.spotless") version "6.25.0"
id("com.gradleup.shadow") version "8.3.3"
}
application {
mainClass.set("no.nav.syfo.ApplicationKt")
val isDevelopment: Boolean = project.ext.has("development")
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
}
repositories {
mavenCentral()
maven {
url = uri("https://github-package-registry-mirror.gc.nav.no/cached/maven-release")
}
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
implementation("io.prometheus:simpleclient_hotspot:$prometheusVersion")
implementation("io.prometheus:simpleclient_common:$prometheusVersion")
implementation("io.ktor:ktor-server-core:$ktorVersion")
implementation("io.ktor:ktor-server-netty:$ktorVersion")
constraints {
implementation("io.netty:netty-common:$nettyCommonVersion") {
because("override transient from io.ktor:ktor-server-netty")
}
}
implementation("io.ktor:ktor-server-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-server-status-pages:$ktorVersion")
implementation("io.ktor:ktor-server-cors:$ktorVersion")
implementation("io.ktor:ktor-server-auth:$ktorVersion")
implementation("io.ktor:ktor-server-auth-jwt:$ktorVersion")
implementation("io.ktor:ktor-serialization-jackson:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-client-apache:$ktorVersion")
implementation("io.ktor:ktor-server-swagger:$ktorVersion")
implementation("no.nav.helse:diagnosekoder:$diagnosekoderVersion")
implementation("org.apache.kafka:kafka_2.12:$kafkaVersion")
constraints {
implementation("org.xerial.snappy:snappy-java:$snappyJavaVersion") {
because("override transient from org.apache.kafka:kafka_2.12")
}
}
implementation("ch.qos.logback:logback-classic:$logbackVersion")
implementation("net.logstash.logback:logstash-logback-encoder:$logstashEncoderVersion")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion")
implementation("com.github.ben-manes.caffeine:caffeine:$caffeineVersion")
testImplementation("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
testImplementation("org.amshove.kluent:kluent:$kluentVersion")
testImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation("io.mockk:mockk:$mockkVersion")
testImplementation("io.ktor:ktor-server-test-host:$ktorVersion") {
exclude(group = "org.eclipse.jetty")
}
}
kotlin {
compilerOptions {
jvmTarget = javaVersion
}
}
tasks {
shadowJar {
archiveBaseName.set("app")
archiveClassifier.set("")
isZip64 = true
manifest {
attributes(
mapOf(
"Main-Class" to "no.nav.syfo.ApplicationKt",
),
)
}
}
test {
useJUnitPlatform {
}
testLogging {
events("skipped", "failed")
showStackTraces = true
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}
register<JavaExec>("generateRuleMermaid") {
val output = ByteArrayOutputStream()
mainClass.set("no.nav.syfo.rules.common.GenerateMermaidKt")
classpath = sourceSets["main"].runtimeClasspath
group = "documentation"
description = "Generates mermaid diagram source of rules"
standardOutput = output
doLast {
val readme = File("README.md")
val lines = readme.readLines()
val starterTag = "<!-- RULE_MARKER_START -->"
val endTag = "<!-- RULE_MARKER_END -->"
val start = lines.indexOfFirst { it.contains(starterTag) }
val end = lines.indexOfFirst { it.contains(endTag) }
val newLines: List<String> =
lines.subList(0, start) +
listOf(
starterTag,
) +
output.toString().split("\n") +
listOf(
endTag,
) +
lines.subList(end + 1, lines.size)
readme.writeText(newLines.joinToString("\n"))
}
}
spotless {
kotlin { ktfmt(ktfmtVersion).kotlinlangStyle() }
check {
dependsOn("spotlessApply")
dependsOn("generateRuleMermaid")
}
}
}