-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
145 lines (111 loc) · 3.89 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.FileWriter
import java.nio.charset.StandardCharsets.*
import java.util.*
plugins {
val kotlinVersion = "1.9.23"
java
id("org.springframework.boot") version "3.2.4"
id("io.spring.dependency-management") version "1.1.4"
kotlin("jvm") version kotlinVersion
kotlin("plugin.spring") version kotlinVersion
kotlin("plugin.serialization") version kotlinVersion
jacoco
}
group = "ootbingo.barinade"
version = "3.3.2-SNAPSHOT"
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
repositories {
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/scaramangado/lily")
credentials {
username = project.properties["githubPackagesUser"]?.let { it as String } ?: ""
password = project.properties["githubPackagesToken"]?.let { it as String } ?: ""
}
}
maven {
name = "m2-dv8tion"
url = uri("https://m2.dv8tion.net/releases")
}
}
dependencies {
implementation("de.scaramangado:lily:0.3.1")
implementation("org.springframework.boot:spring-boot-starter-json")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.flywaydb:flyway-core")
runtimeOnly("org.postgresql:postgresql")
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0")
implementation("org.glassfish.tyrus.bundles:tyrus-standalone-client:2.1.5")
implementation("org.springframework:spring-websocket")
implementation("org.springframework:spring-messaging")
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude(module = "junit-vintage-engine")
exclude(module = "hamcrest-library")
exclude(module = "hamcrest-core")
exclude(module = "json-path")
exclude(module = "jsonassert")
exclude(module = "xmlunit-core")
exclude(group = "org.junit.jupiter")
}
testImplementation("org.assertj:assertj-core:3.25.3")
testImplementation("org.mockito.kotlin:mockito-kotlin:5.2.1")
testImplementation("org.awaitility:awaitility-kotlin")
testImplementation("org.testcontainers:postgresql")
testImplementation("org.testcontainers:junit-jupiter")
}
tasks.withType<Jar> {
dependsOn("versionProperties")
archiveBaseName.set("barinade_bot")
archiveVersion.set("")
}
val versionProperties by tasks.register("versionProperties") {
group = "build"
description = "Saves version and build number in the resources folder."
val properties = Properties()
properties["barinade.version"] = version
properties["barinade.build"] = executeCommand("git log -1 --format=%h")
properties.store(FileWriter("src/main/resources/version.properties", UTF_8, false), null)
}
tasks.withType<Test> {
dependsOn("versionProperties")
useJUnitPlatform()
systemProperties(Pair("spring.profiles.active", "unittest"))
jvmArgs = "-XX:+EnableDynamicAgentLoading".let {
@Suppress("UNNECESSARY_SAFE_CALL", "USELESS_ELVIS")
jvmArgs?.plus(it) ?: mutableListOf(it)
}
testLogging {
events("passed", "skipped", "failed")
}
finalizedBy("jacocoTestReport")
}
tasks.withType<JacocoReport> {
reports {
xml.required.set(true)
}
}
fun executeCommand(command: String): String =
try {
Runtime.getRuntime().exec(command.split(" ").toTypedArray()).inputStream.bufferedReader().readLine()
} catch (e: Exception) {
""
}
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
jvmTarget = "21"
freeCompilerArgs = listOf("-Xjvm-default=all")
}
val compileTestKotlin: KotlinCompile by tasks
compileTestKotlin.kotlinOptions {
jvmTarget = "21"
}