-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
178 lines (143 loc) · 6.04 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import java.io.ByteArrayOutputStream
val javaVersion = JavaLanguageVersion.of(21)
val familieProsesseringVersion = "2.20241112093526_694e258"
val tilleggsstønaderLibsVersion = "2025.03.14-14.38.d650c79601e9"
val tilleggsstønaderKontrakterVersion = "2025.03.17-10.34.19d9ad1090ff"
val avroVersion = "1.12.0"
val confluentVersion = "7.9.0"
val joarkHendelseVersion = "1.1.6"
val tokenSupportVersion = "5.0.11"
val wiremockVersion = "3.9.2"
val mockkVersion = "1.13.12"
val testcontainerVersion = "1.20.3"
group = "no.nav.tilleggsstonader.sak"
version = "1.0.0"
plugins {
application
kotlin("jvm") version "2.0.21"
id("com.diffplug.spotless") version "7.0.2"
id("com.github.ben-manes.versions") version "0.51.0"
id("se.patrikerdes.use-latest-versions") version "0.2.18"
id("org.springframework.boot") version "3.3.5"
id("io.spring.dependency-management") version "1.1.6"
kotlin("plugin.spring") version "2.0.21"
id("com.github.davidmc24.gradle.plugin.avro") version "1.9.1"
id("org.cyclonedx.bom") version "1.10.0"
}
repositories {
mavenCentral()
mavenLocal()
maven(url = "https://github-package-registry-mirror.gc.nav.no/cached/maven-release")
maven(url = "https://packages.confluent.io/maven/")
}
apply(plugin = "com.diffplug.spotless")
spotless {
kotlin {
ktlint("1.5.0")
}
}
configurations.all {
resolutionStrategy {
failOnNonReproducibleResolution()
}
}
dependencies {
// Spring
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-data-jdbc")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.postgresql:postgresql")
implementation("org.flywaydb:flyway-database-postgresql")
// Kafka
implementation("org.springframework.kafka:spring-kafka")
implementation("org.apache.avro:avro:$avroVersion")
implementation("io.confluent:kafka-avro-serializer:$confluentVersion")
implementation("no.nav.teamdokumenthandtering:teamdokumenthandtering-avro-schemas:$joarkHendelseVersion")
// Logging
implementation("net.logstash.logback:logstash-logback-encoder:8.0")
implementation("io.micrometer:micrometer-registry-prometheus")
implementation("no.nav.familie:prosessering-core:$familieProsesseringVersion")
// Tillegggsstønader libs
implementation("no.nav.tilleggsstonader-libs:util:$tilleggsstønaderLibsVersion")
implementation("no.nav.tilleggsstonader-libs:log:$tilleggsstønaderLibsVersion")
implementation("no.nav.tilleggsstonader-libs:http-client:$tilleggsstønaderLibsVersion")
implementation("no.nav.tilleggsstonader-libs:sikkerhet:$tilleggsstønaderLibsVersion")
implementation("no.nav.tilleggsstonader-libs:unleash:$tilleggsstønaderLibsVersion")
implementation("no.nav.tilleggsstonader-libs:kafka:$tilleggsstønaderLibsVersion")
implementation("no.nav.tilleggsstonader.kontrakter:tilleggsstonader-kontrakter:$tilleggsstønaderKontrakterVersion")
// For auditlogger. August, 2014, men det er den som blir brukt på NAV
implementation("com.papertrailapp:logback-syslog4j:1.0.0")
// Test
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude(module = "mockito-core")
}
testImplementation("org.junit.platform:junit-platform-suite")
testImplementation("org.wiremock:wiremock-standalone:$wiremockVersion")
testImplementation("io.mockk:mockk:$mockkVersion")
testImplementation("org.testcontainers:postgresql:$testcontainerVersion")
testImplementation("no.nav.security:token-validation-spring-test:$tokenSupportVersion")
testImplementation("no.nav.tilleggsstonader-libs:test-util:$tilleggsstønaderLibsVersion")
testImplementation(platform("io.cucumber:cucumber-bom:7.20.1"))
testImplementation("io.cucumber:cucumber-java")
testImplementation("io.cucumber:cucumber-junit-platform-engine")
}
kotlin {
jvmToolchain(javaVersion.asInt())
compilerOptions {
freeCompilerArgs.add("-Xjsr305=strict")
}
}
application {
mainClass.set("no.nav.tilleggsstonader.sak.AppKt")
}
if (project.hasProperty("skipLint")) {
gradle.startParameter.excludedTaskNames += "spotlessKotlinCheck"
}
// Oppretter version.properties med git-sha som version
tasks {
fun getCheckedOutGitCommitHash(): String {
if (System.getenv("GITHUB_ACTIONS") == "true") {
return System.getenv("GITHUB_SHA")
}
val byteOut = ByteArrayOutputStream()
project.exec {
commandLine = "git rev-parse --verify HEAD".split("\\s".toRegex())
standardOutput = byteOut
}
return String(byteOut.toByteArray()).trim()
}
val projectProps by registering(WriteProperties::class) {
destinationFile = layout.buildDirectory.file("version.properties")
// Define property.
property("project.version", getCheckedOutGitCommitHash())
}
processResources {
// Depend on output of the task to create properties,
// so the properties file will be part of the Java resources.
from(projectProps)
}
}
tasks.test {
useJUnitPlatform()
testLogging {
events = setOf(TestLogEvent.FAILED)
exceptionFormat = TestExceptionFormat.FULL
showStackTraces = false
showCauses = false
}
// Work around. Gradle does not include enough information to disambiguate
// between different examples and scenarios.
systemProperty("cucumber.junit-platform.naming-strategy", "long")
}
tasks.bootJar {
archiveFileName.set("app.jar")
}
tasks.cyclonedxBom {
setIncludeConfigs(listOf("runtimeClasspath", "compileClasspath"))
}