-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
58 lines (46 loc) · 1.23 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
58 lines (46 loc) · 1.23 KB
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
plugins {
kotlin("jvm") version "2.0.0"
id("com.github.johnrengelman.shadow") version "8.1.1"
application
}
group = "ModuleCI"
// Функции для работы с версией
val versionFile = File("version.txt")
fun getVersion(): String {
if (!versionFile.exists()) {
versionFile.writeText("0.1.0")
}
return versionFile.readText().trim()
}
fun incrementVersion() {
val versionParts = versionFile.readText().trim().split(".")
val newPatchVersion = versionParts.last().toInt() + 1
val newVersion = versionParts.dropLast(1) + newPatchVersion.toString()
versionFile.writeText(newVersion.joinToString("."))
}
version = getVersion()
tasks.register("incrementVersion") {
doLast {
incrementVersion()
}
}
tasks.named("build") {
dependsOn("incrementVersion")
}
repositories {
mavenCentral()
}
dependencies {
testImplementation(kotlin("test"))
implementation("com.hierynomus:sshj:0.39.0")
implementation("com.typesafe:config:1.4.2")
implementation("org.slf4j:slf4j-api:2.0.16")
implementation("ch.qos.logback:logback-classic:1.5.12")
}
tasks.test {
useJUnitPlatform()
}
application { mainClass.set("ib.infobot.MainKt") }
kotlin {
jvmToolchain(17)
}