This repository has been archived by the owner on Aug 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
188 lines (156 loc) · 5.58 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
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.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
application
kotlin("jvm") version Kotlin.version
id(Spotless.spotless) version Spotless.version
id(Shadow.shadow) version Shadow.version
}
buildscript {
repositories {
jcenter()
}
}
apply {
plugin(Spotless.spotless)
}
repositories {
mavenCentral()
jcenter()
maven("https://jitpack.io")
}
application {
applicationName = "dagpenger-oppslag"
mainClassName = "no.nav.dagpenger.oppslag.OppslagAppKt"
}
val cxfVersion = "3.3.1"
val tjenestespesifikasjonerVersion = "1.2019.01.16-21.19-afc54bed6f85"
fun tjenestespesifikasjon(name: String) = "no.nav.tjenestespesifikasjoner:$name:$tjenestespesifikasjonerVersion"
dependencies {
constraints {
implementation("com.fasterxml.jackson.core:jackson-databind:${Jackson.version}") {
because("previous versions have a vulnerability")
}
implementation("commons-collections:commons-collections:3.2.2") {
because("previous versions have a vulnerability")
}
implementation("org.bouncycastle:bcprov-jdk15on:1.56") {
because("previous versions have a vulnerability")
}
implementation("org.cryptacular:cryptacular:1.2.4") {
because("previous versions have a vulnerability")
}
}
implementation(kotlin("stdlib"))
implementation(Fuel.fuel)
implementation(Fuel.fuelMoshi)
implementation(Moshi.moshi)
implementation(Moshi.moshiAdapters)
implementation(Moshi.moshiKotlin)
implementation(Moshi.moshiKtor)
implementation(Ktor.server)
implementation(Ktor.serverNetty)
implementation(Ktor.auth)
implementation(Ktor.authJwt)
implementation(Ktor.locations)
implementation(Ktor.micrometerMetrics)
implementation(Konfig.konfig)
implementation(Micrometer.prometheusRegistry)
implementation(Prometheus.common)
implementation(Prometheus.hotspot)
implementation(Prometheus.log4j2)
implementation(Dagpenger.Biblioteker.ktorUtils)
implementation(Dagpenger.Biblioteker.stsKlient)
implementation(Log4j2.api)
implementation(Log4j2.core)
implementation(Log4j2.slf4j)
implementation(Log4j2.Logstash.logstashLayout)
implementation(Kotlin.Logging.kotlinLogging)
// Soap stuff
implementation("javax.xml.ws:jaxws-api:2.3.1")
implementation("com.sun.xml.ws:jaxws-tools:2.3.0.2")
compile(tjenestespesifikasjon("person-v3-tjenestespesifikasjon"))
implementation("org.apache.cxf:cxf-rt-features-logging:$cxfVersion")
implementation("org.apache.cxf:cxf-rt-frontend-jaxws:$cxfVersion")
implementation("org.apache.cxf:cxf-rt-ws-policy:$cxfVersion")
implementation("org.apache.cxf:cxf-rt-ws-security:$cxfVersion")
implementation("org.apache.cxf:cxf-rt-transports-http:$cxfVersion")
implementation("javax.activation:activation:1.1.1")
implementation("no.nav.helse:cxf-prometheus-metrics:dd7d125")
testImplementation("org.apache.cxf:cxf-rt-transports-http:$cxfVersion")
// Soap stuff end
testImplementation(kotlin("test"))
testImplementation(Ktor.ktorTest)
testImplementation(Junit5.api)
testImplementation(KoTest.runner)
testRuntimeOnly(Junit5.engine)
testImplementation(Wiremock.standalone)
testImplementation(Mockk.mockk)
}
spotless {
kotlin {
ktlint(Ktlint.version)
}
kotlinGradle {
target("*.gradle.kts", "buildSrc/**/*.kt*")
ktlint(Ktlint.version)
}
}
java {
val mainJavaSourceSet: SourceDirectorySet = sourceSets.getByName("main").java
mainJavaSourceSet.srcDir("$projectDir/build/generated-sources")
}
val wsdlDir = "$projectDir/src/main/resources/wsdl"
val wsdlsToGenerate = listOf(
"$wsdlDir/arena/Binding.wsdl",
"$wsdlDir/arbeidsfordeling/Binding.wsdl",
"$wsdlDir/hentsak/arenaSakVedtakService.wsdl"
)
val generatedDir = "$projectDir/build/generated-sources"
tasks.withType<ShadowJar> {
mergeServiceFiles()
// Make sure the cxf service files are handled correctly so that the SOAP services work.
// Ref https://stackoverflow.com/questions/45005287/serviceconstructionexception-when-creating-a-cxf-web-service-client-scalajava
transform(ServiceFileTransformer::class.java) {
setPath("META-INF/cxf")
include("bus-extensions.txt")
}
}
tasks {
register("wsimport") {
inputs.files(wsdlsToGenerate)
outputs.dir(generatedDir)
group = "other"
doLast {
mkdir(generatedDir)
wsdlsToGenerate.forEach {
ant.withGroovyBuilder {
"taskdef"(
"name" to "wsimport",
"classname" to "com.sun.tools.ws.ant.WsImport",
"classpath" to sourceSets.getAt("main").runtimeClasspath.asPath
)
"wsimport"("wsdl" to it, "sourcedestdir" to generatedDir, "xnocompile" to true) {}
}
}
}
}
}
tasks.getByName("compileKotlin").dependsOn("wsimport")
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
showExceptions = true
showStackTraces = true
exceptionFormat = TestExceptionFormat.FULL
events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
}
}
tasks.named("shadowJar") {
dependsOn("test")
}
tasks.named("compileKotlin") {
dependsOn("spotlessKotlinCheck")
}