-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
106 lines (89 loc) · 2.79 KB
/
build.gradle.kts
File metadata and controls
106 lines (89 loc) · 2.79 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
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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.apache.tools.ant.taskdefs.condition.Os
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import java.util.Calendar
import java.util.TimeZone
plugins {
val kotlin_version: String by System.getProperties()
kotlin("jvm").version(kotlin_version)
kotlin("plugin.serialization").version(kotlin_version)
id("com.gradleup.shadow") version "8.3.6"
}
val kotlin_version: String by System.getProperties()
val ktor_version: String by project
group = "cc.modlabs"
version = System.getenv("VERSION_OVERRIDE") ?: Calendar.getInstance(TimeZone.getTimeZone("UTC")).run {
"${get(Calendar.YEAR)}.${get(Calendar.MONTH) + 1}.${get(Calendar.DAY_OF_MONTH)}-${
String.format("%02d%02d", get(Calendar.HOUR_OF_DAY), get(Calendar.MINUTE))
}"
}
repositories {
maven("https://nexus.modlabs.cc/repository/maven-mirrors/")
}
val shadowDependencies = listOf(
"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version",
"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version",
"io.ktor:ktor-client-core:$ktor_version",
"io.ktor:ktor-client-cio:$ktor_version",
"io.ktor:ktor-client-content-negotiation:$ktor_version",
"io.ktor:ktor-serialization-kotlinx-json:$ktor_version"
//"cc.modlabs:ktale:${project.ext["ktaleVersion"] as String}",
//"cc.modlabs:KlassicX:2025.12.4.1928"
)
dependencies {
testImplementation(kotlin("test"))
implementation("com.hypixel.hytale:Server:2026.01.13-dcad8778f")
shadowDependencies.forEach {
shadow(it)
implementation(it)
}
}
tasks.test {
useJUnitPlatform()
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(25))
}
compilerOptions {
jvmTarget.set(JvmTarget.JVM_25)
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(25))
}
}
val cleanArtifacts = tasks.register<Exec>("cleanArtifacts") {
group = "build"
description = "Runs cleanlibs.bat on Windows or cleanlibs.sh on *nix before build"
workingDir = project.rootDir
// choose the right command based on OS
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine("cmd", "/c", "cleanlibs.bat")
} else {
commandLine("sh", "cleanlibs.sh")
}
}
tasks {
jar {
dependsOn(cleanArtifacts)
}
build {
dependsOn("shadowJar")
}
withType<ProcessResources> {
filesMatching("manifest.json") {
expand(
"version" to project.version,
"name" to project.name,
)
}
}
withType<ShadowJar> {
mergeServiceFiles()
configurations = listOf(project.configurations.shadow.get())
archiveFileName.set(project.name + "-" + project.version + "-shaded.jar")
exclude("_COROUTINE/**")
}
}