generated from ministryofjustice/hmpps-template-kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
116 lines (99 loc) · 3.69 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
plugins {
id("uk.gov.justice.hmpps.gradle-spring-boot") version "4.8.3"
kotlin("plugin.spring") version "1.8.10"
}
configurations {
testImplementation { exclude(group = "org.junit.vintage") }
}
var awsSdkVersion = "1.12.543"
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("com.microsoft.azure:applicationinsights-spring-boot-starter:2.6.4")
implementation("com.amazonaws:aws-java-sdk-sqs:$awsSdkVersion")
implementation("com.amazonaws:aws-java-sdk-sns:$awsSdkVersion")
implementation("com.amazonaws:aws-java-sdk-sts:$awsSdkVersion")
implementation("org.springframework.cloud:spring-cloud-aws-messaging:2.2.6.RELEASE")
// Spring uses 2.11.4 - using 2.12.3 breaks Spring.
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.13.4")
runtimeOnly("org.springframework.boot:spring-boot-devtools")
testImplementation(platform("org.junit:junit-bom:5.9.2"))
testRuntimeOnly("org.junit.jupiter:junit-jupiter")
testImplementation("org.springframework.boot:spring-boot-starter-webflux")
testImplementation("com.github.tomakehurst:wiremock-jre8:2.35.0")
testImplementation("org.mockito:mockito-core:5.1.1")
testImplementation("org.awaitility:awaitility:4.2.0")
}
tasks {
compileKotlin {
kotlinOptions {
jvmTarget = "19"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "19"
}
}
test {
useJUnitPlatform()
testLogging.showExceptions = true
testLogging.showStackTraces = true
exclude("**/*IntTest*")
val failedTests = mutableListOf<TestDescriptor>()
val skippedTests = mutableListOf<TestDescriptor>()
// See https://github.com/gradle/kotlin-dsl/issues/836
addTestListener(object : TestListener {
override fun beforeSuite(suite: TestDescriptor) {}
override fun beforeTest(testDescriptor: TestDescriptor) {}
override fun afterTest(testDescriptor: TestDescriptor, result: TestResult) {
when (result.resultType) {
TestResult.ResultType.FAILURE -> failedTests.add(testDescriptor)
TestResult.ResultType.SKIPPED -> skippedTests.add(testDescriptor)
}
}
override fun afterSuite(suite: TestDescriptor, result: TestResult) {
if (suite.parent == null) { // root suite
logger.lifecycle("----")
logger.lifecycle("Test result: ${result.resultType}")
logger.lifecycle(
"Test summary: ${result.testCount} tests, " +
"${result.successfulTestCount} succeeded, " +
"${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped"
)
if (failedTests.isNotEmpty()) {
logger.lifecycle("\tFailed Tests:")
failedTests.forEach {
parent?.let { parent ->
logger.lifecycle("\t\t${parent.name} - ${it.name}")
} ?: logger.lifecycle("\t\t${it.name}")
}
}
if (skippedTests.isNotEmpty()) {
logger.lifecycle("\tSkipped Tests:")
skippedTests.forEach {
parent?.let { parent ->
logger.lifecycle("\t\t${parent.name} - ${it.name}")
} ?: logger.lifecycle("\t\t${it.name}")
}
}
}
}
})
}
}
task<Test>("integrationTest") {
description = "Runs the integration tests"
group = "verification"
testLogging.showExceptions = true
testLogging.showStackTraces = true
include("**/*IntTest*")
}
repositories {
mavenCentral()
}
tasks.register<Copy>("installGitHooks") {
from(layout.projectDirectory.dir("hooks"))
into(layout.projectDirectory.dir(".git/hooks"))
}