-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
200 lines (165 loc) · 6.25 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
group = "no.nav.helse.flex"
version = "1.0.0"
val coroutinesVersion = "1.4.2-native-mt"
val jacksonVersion = "2.12.1"
val postgresEmbeddedVersion = "0.13.3"
val kluentVersion = "1.65"
val ktorVersion = "1.5.1"
val logbackVersion = "1.2.3"
val logstashEncoderVersion = "6.6"
val mockkVersion = "1.11.0"
val nimbusdsVersion = "9.5"
val prometheusVersion = "0.10.0"
val spekVersion = "2.0.15"
val testContainerKafkaVersion = "1.15.2"
val confluentVersion = "6.0.1"
val postgresVersion = "42.2.18"
val flywayVersion = "7.5.2"
val hikariVersion = "4.0.1"
val brukernotifikasjonAvroVersion = "1.2020.08.13-13.50-3b6ca1881161"
val ktlint by configurations.creating
val outputDir = "${project.buildDir}/reports/ktlint/"
val inputFiles = project.fileTree(mapOf("dir" to "src", "include" to "**/*.kt"))
tasks.withType<Jar> {
manifest.attributes["Main-Class"] = "no.nav.helse.flex.BootstrapKt"
}
tasks.test {
useJUnitPlatform()
jvmArgs("--enable-preview")
}
plugins {
id("org.jmailen.kotlinter") version "3.3.0"
kotlin("jvm") version "1.4.30"
id("com.diffplug.spotless") version "5.9.0"
id("com.github.johnrengelman.shadow") version "6.1.0"
id("com.github.ben-manes.versions") version "0.36.0"
jacoco
}
buildscript {
dependencies {
classpath("javax.xml.bind:jaxb-api:2.4.0-b180830.0359")
classpath("org.glassfish.jaxb:jaxb-runtime:3.0.0")
classpath("com.sun.activation:javax.activation:1.2.0")
}
}
val githubUser: String by project
val githubPassword: String by project
repositories {
mavenCentral()
jcenter()
maven(url = "https://dl.bintray.com/kotlin/ktor")
maven(url = "https://dl.bintray.com/spekframework/spek-dev")
maven(url = "https://packages.confluent.io/maven/")
maven(url = "https://kotlin.bintray.com/kotlinx")
maven(url = "https://jitpack.io")
maven {
url = uri("https://maven.pkg.github.com/navikt/syfosm-common")
credentials {
username = githubUser
password = githubPassword
}
}
}
dependencies {
implementation(kotlin("stdlib"))
ktlint("com.pinterest:ktlint:0.40.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:$coroutinesVersion")
implementation("io.prometheus:simpleclient_hotspot:$prometheusVersion")
implementation("io.prometheus:simpleclient_common:$prometheusVersion")
implementation("io.ktor:ktor-server-netty:$ktorVersion")
implementation("io.ktor:ktor-client-apache:$ktorVersion")
implementation("io.ktor:ktor-client-auth-basic:$ktorVersion")
implementation("io.ktor:ktor-client-jackson:$ktorVersion")
implementation("io.ktor:ktor-jackson:$ktorVersion")
implementation("io.ktor:ktor-auth:$ktorVersion")
implementation("io.ktor:ktor-auth-jwt:$ktorVersion")
implementation("io.confluent:kafka-avro-serializer:$confluentVersion")
implementation("com.github.navikt:brukernotifikasjon-schemas:$brukernotifikasjonAvroVersion")
implementation("ch.qos.logback:logback-classic:$logbackVersion")
implementation("net.logstash.logback:logstash-logback-encoder:$logstashEncoderVersion")
implementation("org.postgresql:postgresql:$postgresVersion")
implementation("com.zaxxer:HikariCP:$hikariVersion")
implementation("org.flywaydb:flyway-core:$flywayVersion")
implementation("com.fasterxml.jackson.module:jackson-module-jaxb-annotations:$jacksonVersion")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion")
testImplementation("org.amshove.kluent:kluent:$kluentVersion")
testImplementation("io.mockk:mockk:$mockkVersion")
testImplementation("org.spekframework.spek2:spek-dsl-jvm:$spekVersion")
testImplementation("com.nimbusds:nimbus-jose-jwt:$nimbusdsVersion")
testImplementation("org.testcontainers:kafka:$testContainerKafkaVersion")
testImplementation("io.ktor:ktor-server-test-host:$ktorVersion") {
exclude(group = "org.eclipse.jetty")
}
testImplementation("org.spekframework.spek2:spek-dsl-jvm:$spekVersion") {
exclude(group = "org.jetbrains.kotlin")
}
testRuntimeOnly("org.spekframework.spek2:spek-runner-junit5:$spekVersion") {
exclude(group = "org.jetbrains.kotlin")
}
testImplementation("com.opentable.components:otj-pg-embedded:$postgresEmbeddedVersion")
}
val ktlintCheck by tasks.creating(JavaExec::class) {
inputs.files(inputFiles)
outputs.dir(outputDir)
description = "Check Kotlin code style."
classpath = ktlint
main = "com.pinterest.ktlint.Main"
args = listOf("src/**/*.kt")
}
val ktlintFormat by tasks.creating(JavaExec::class) {
inputs.files(inputFiles)
outputs.dir(outputDir)
description = "Fix Kotlin code style deviations."
classpath = ktlint
main = "com.pinterest.ktlint.Main"
args = listOf("-F", "src/**/*.kt")
}
tasks.jacocoTestReport {
reports {
xml.isEnabled = true
html.isEnabled = true
}
}
tasks {
create("printVersion") {
println(project.version)
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "12"
}
withType<JacocoReport> {
classDirectories.setFrom(
sourceSets.main.get().output.asFileTree.matching {
exclude()
}
)
}
withType<ShadowJar> {
transform(ServiceFileTransformer::class.java) {
setPath("META-INF/cxf")
include("bus-extensions.txt")
}
}
withType<Test> {
useJUnitPlatform {
includeEngines("spek2")
}
testLogging.showStandardStreams = true
}
"check" {
dependsOn("formatKotlin")
}
}
tasks.named("dependencyUpdates", DependencyUpdatesTask::class.java).configure {
// optional parameters
checkForGradleUpdate = true
outputFormatter = "json"
outputDir = "build/dependencyUpdates"
reportfileName = "report"
}