-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
70 lines (57 loc) · 1.79 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
plugins {
jacoco
kotlin("jvm") version "2.0.10"
}
version = "1.2.0"
repositories {
mavenCentral()
}
val telegramSdkVersion = "7.10.0"
dependencies {
implementation(kotlin("stdlib"))
implementation("ch.qos.logback:logback-classic:1.5.6")
implementation("com.google.code.gson:gson:2.11.0")
implementation("io.github.oshai:kotlin-logging-jvm:6.0.9")
implementation("org.telegram:telegrambots-client:$telegramSdkVersion")
implementation("org.telegram:telegrambots-longpolling:$telegramSdkVersion")
testImplementation(kotlin("test"))
testImplementation("io.mockk:mockk:1.13.12")
testImplementation("org.assertj:assertj-core:3.11.1")
}
val libsDirProvider = layout.buildDirectory.file("libs")
tasks {
test {
useJUnitPlatform()
finalizedBy(jacocoTestReport)
}
jacocoTestReport {
dependsOn(test)
reports {
xml.required = true
}
}
jar {
manifest {
attributes["Main-Class"] = "guru.MainKt"
attributes["Class-Path"] = configurations.runtimeClasspath.get()
.map { "libs/${it.name}" }
.joinToString(" ")
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
// Copy runtime dependencies to the libs directory inside the JAR
doFirst {
val libDir = libsDirProvider.get().asFile
if (!libDir.exists()) {
libDir.mkdirs()
}
configurations.runtimeClasspath.get().forEach { file ->
copy {
from(file)
into(libDir)
}
}
}
// Include the dependencies in the JAR
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
}
}