-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
70 lines (58 loc) · 2.03 KB
/
build.gradle.kts
File metadata and controls
70 lines (58 loc) · 2.03 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
59
60
61
62
63
64
65
66
67
68
69
70
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.ByteArrayOutputStream
plugins {
kotlin("jvm") version "1.8.10"
id ("org.jetbrains.kotlin.plugin.spring") version "1.8.10"
id ("org.springframework.boot") version "2.6.3"
id ("io.spring.dependency-management") version "1.0.11.RELEASE"
}
group = "com.github.fastmirrorserver"
version = "0.0.0"
repositories {
mavenCentral()
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.8.10")
implementation("org.postgresql:postgresql:42.3.8")
implementation("org.springframework.boot:spring-boot-starter-jdbc:2.7.2")
implementation("org.springframework.boot:spring-boot-starter:2.7.2")
implementation("org.springframework.boot:spring-boot-starter-web:2.7.2")
implementation("org.springframework.boot:spring-boot-starter-data-redis:2.7.2")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.3")
implementation("org.ktorm:ktorm-core:3.5.0")
implementation("org.ktorm:ktorm-support-postgresql:3.5.0")
implementation("org.ktorm:ktorm-jackson:3.5.0")
testImplementation(kotlin("test"))
testImplementation("org.springframework.boot:spring-boot-starter-test:2.7.0")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
}
tasks.test {
useJUnitPlatform()
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "11"
}
fun getTag(): String {
val stdout = ByteArrayOutputStream()
exec {
commandLine("git", "describe", "--tags")
standardOutput = stdout
}
val output = stdout.toString("UTF-8")
return (if(output[0] == 'v') output.substring(1)
else output).trim()
}
fun getCommitId(): String {
val stdout = ByteArrayOutputStream()
exec {
commandLine("git", "rev-parse", "--short", "HEAD")
standardOutput = stdout
}
return stdout.toString("UTF-8").trim()
}
tasks.bootJar {
val ver = "${getTag()}-${getCommitId()}"
println(ver)
project.version = ver
archiveFileName.set("server.jar")
}