-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
103 lines (88 loc) · 2.43 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
plugins {
id("server.common-conventions")
id("com.github.johnrengelman.shadow") version "7.1.0"
kotlin("plugin.serialization") version "1.6.21"
id("net.kyori.blossom") version "2.1.0"
`maven-publish`
}
group = "com.bluedragonmc"
version = "1.0-SNAPSHOT"
repositories {
mavenLocal()
mavenCentral()
maven(url = "https://jitpack.io")
}
subprojects {
repositories {
mavenLocal()
mavenCentral()
maven(url = "https://jitpack.io")
}
}
dependencies {
testImplementation(kotlin("test"))
testImplementation(libs.mockk)
testImplementation(libs.junit.api)
testRuntimeOnly(libs.junit.engine)
implementation(libs.minestom) // Minestom
implementation(libs.minimessage) // MiniMessage
implementation(libs.kmongo) // Database support
implementation(libs.caffeine) // Caching library for database responses
implementation(libs.bundles.configurate) // Configurate for game configuration
implementation(libs.bundles.messaging) // Messaging
implementation(libs.okhttp)
implementation(project(":common"))
}
sourceSets {
main {
blossom {
val gitCommit = getOutputOf("git rev-parse --verify --short HEAD")
val gitBranch = getOutputOf("git rev-parse --abbrev-ref HEAD")
val gitCommitDate = getOutputOf("git log -1 --format=%ct")
kotlinSources {
property("gitCommit", gitCommit)
property("gitBranch", gitBranch)
property("gitCommitDate", gitCommitDate)
}
}
}
}
fun getOutputOf(command: String): String? {
try {
val stream = org.apache.commons.io.output.ByteArrayOutputStream()
project.exec {
commandLine = command.split(" ")
standardOutput = stream
}
return String(stream.toByteArray()).trim()
} catch (e: Throwable) {
return null
}
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = "com.bluedragonmc"
artifactId = "Server"
version = "1.0"
from(components["java"])
}
}
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
tasks.test {
useJUnitPlatform()
}
tasks.shadowJar {
mergeServiceFiles()
}
tasks.jar {
dependsOn(tasks.shadowJar)
manifest {
attributes["Main-Class"] = "com.bluedragonmc.server.ServerKt"
}
}