-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
169 lines (139 loc) · 6.22 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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
val flywayVersion = "11.3.3"
val h2Version = "2.3.232"
val jacksonVersion = "2.18.2"
val kotlinLoggerVersion = "3.0.5"
val ktorVersion = "3.1.0"
val logbackVersion = "1.5.16"
val logstashVersion = "8.0"
val micrometerVersion = "1.14.4"
val mockOauthVersion = "2.1.10"
val mockkVersion = "1.13.16"
val navCommonVersion = "3.2025.01.14_14.19-79b3041cae56"
val ojdbc8Version = "19.3.0.0"
val postgresVersion = "42.7.5"
val swaggerVersion = "5.18.3" // Husk å endre versjonen også i resource i SwaggerUi.kt
val tjenestespecVersion = "2641.575768a"
val tokenValidationVersion = "5.0.17"
val vaultJdbcVersion = "1.3.10"
val vaultVersion = "5.1.0"
project.setProperty("mainClassName", "io.ktor.server.netty.EngineMain")
repositories {
mavenCentral()
maven("https://plugins.gradle.org/m2/")
maven("https://jitpack.io")
maven("https://github-package-registry-mirror.gc.nav.no/cached/maven-release")
maven("https://build.shibboleth.net/maven/releases/")
}
plugins {
id("com.github.ManifestClasspath") version "0.1.0-RELEASE"
kotlin("jvm") version "2.1.10"
kotlin("plugin.allopen") version "2.1.10"
kotlin("plugin.serialization") version "2.1.10"
id("com.gradleup.shadow") version "8.3.6"
id("org.flywaydb.flyway") version ("11.1.0")
id("org.sonarqube") version "6.0.1.5171"
id("com.github.ben-manes.versions") version "0.52.0"
jacoco
application
}
jacoco {
toolVersion = "0.8.11"
}
application {
mainClass.set(project.property("mainClassName").toString())
}
dependencies {
implementation(kotlin("stdlib"))
implementation("ch.qos.logback:logback-classic:$logbackVersion")
implementation("ch.qos.logback:logback-core:$logbackVersion")
implementation("com.bettercloud:vault-java-driver:$vaultVersion")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion")
implementation("com.fasterxml.jackson.module:jackson-module-parameter-names:$jacksonVersion")
implementation("com.oracle.ojdbc:ojdbc8:$ojdbc8Version")
implementation("io.github.microutils:kotlin-logging:$kotlinLoggerVersion")
implementation("io.ktor:ktor-client-apache:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-client-jackson:$ktorVersion")
implementation("io.ktor:ktor-client-json:$ktorVersion")
implementation("io.ktor:ktor-serialization-jackson:$ktorVersion")
implementation("io.ktor:ktor-server-auth-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-auth-jwt:$ktorVersion")
implementation("io.ktor:ktor-server-call-id:$ktorVersion")
implementation("io.ktor:ktor-server-call-logging:$ktorVersion")
implementation("io.ktor:ktor-server-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-server-default-headers:$ktorVersion")
implementation("io.ktor:ktor-server-double-receive:$ktorVersion")
implementation("io.ktor:ktor-server-resources:$ktorVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
implementation("io.ktor:ktor-server-metrics-micrometer:$ktorVersion")
implementation("io.ktor:ktor-server-netty:$ktorVersion")
implementation("io.micrometer:micrometer-registry-prometheus:$micrometerVersion")
implementation("net.logstash.logback:logstash-logback-encoder:$logstashVersion")
implementation("no.nav.common:util:$navCommonVersion")
implementation("no.nav.security:token-validation-ktor-v3:$tokenValidationVersion")
implementation("com.github.navikt.tjenestespesifikasjoner:arena-sakogaktivitet_v1:$tjenestespecVersion")
implementation("org.flywaydb:flyway-database-oracle:$flywayVersion")
implementation("org.postgresql:postgresql:$postgresVersion")
implementation("org.webjars:swagger-ui:$swaggerVersion")
implementation("no.nav:vault-jdbc:$vaultJdbcVersion")
// Lokal kjøring
implementation("org.flywaydb:flyway-database-postgresql:$flywayVersion")
testImplementation(kotlin("test-junit5"))
testImplementation("com.h2database:h2:$h2Version")
testImplementation("io.ktor:ktor-client-mock:$ktorVersion")
testImplementation("io.ktor:ktor-server-test-host:$ktorVersion")
testImplementation("io.mockk:mockk:$mockkVersion")
testImplementation("no.nav.security:mock-oauth2-server:$mockOauthVersion")
}
configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
tasks {
withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_21)
}
}
withType<Jar> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest.attributes["Main-Class"] = project.property("mainClassName").toString()
from(configurations.compileClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
}
withType<ShadowJar> {
isZip64 = true
mergeServiceFiles()
}
withType<Test> {
useJUnitPlatform()
testLogging {
exceptionFormat = TestExceptionFormat.FULL
events("passed", "skipped", "failed")
}
}
jacocoTestReport {
reports {
xml.required.set(true)
}
}
named("sonarqube") {
dependsOn("jacocoTestReport")
}
register("runServer", JavaExec::class) {
mainClass.set(project.property("mainClassName").toString())
classpath = sourceSets["main"].runtimeClasspath
}
register("runServerTest", JavaExec::class) {
systemProperties["TOKEN_X_WELL_KNOWN_URL"] = "tokenx.dev.nav.no"
systemProperties["TOKEN_X_CLIENT_ID"] = "test:meldekort:meldekortservice"
mainClass.set(project.property("mainClassName").toString())
classpath = sourceSets["main"].runtimeClasspath
}
}