This repository was archived by the owner on Dec 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
90 lines (70 loc) · 2.18 KB
/
build.gradle.kts
File metadata and controls
90 lines (70 loc) · 2.18 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
import java.security.MessageDigest
plugins {
kotlin("jvm") version "2.0.0"
kotlin("plugin.serialization") version "2.0.0"
application
id("io.github.goooler.shadow") version "8.1.7"
}
group = "team.ktusers"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven("https://mvn.bladehunt.net/releases")
maven("https://jitpack.io")
}
dependencies {
implementation(libs.minestom)
implementation(libs.blade)
implementation(libs.minigamelib)
implementation(libs.bundles.kotstom)
implementation(libs.polar)
implementation(libs.minestompvp)
implementation(libs.kotlinx.coroutines)
implementation(libs.kotlinx.serialization.json)
implementation(libs.bundles.logback)
testImplementation(kotlin("test"))
}
task<Zip>("compressResourcePack") {
destinationDirectory.set(layout.projectDirectory.dir("resource_pack").dir("compressed"))
archiveFileName = "resource_pack_${version}.zip"
from(layout.projectDirectory.dir("resource_pack").dir("src"))
}
task("generateResourcePack") {
dependsOn("compressResourcePack")
doLast {
val zipFile =
layout.projectDirectory
.file("resource_pack/compressed/resource_pack_${project.version}.zip")
.asFile
val shaFile =
layout.projectDirectory
.file("resource_pack/compressed/resource_pack_${project.version}.sha1")
.asFile
val sha1 = MessageDigest.getInstance("SHA-1")
zipFile.inputStream().use { input ->
val buffer = ByteArray(8192)
var read: Int
while (input.read(buffer).also { read = it } != -1) {
sha1.update(buffer, 0, read)
}
}
val sha1Hash = sha1.digest().joinToString("") { "%02x".format(it) }
shaFile.writeText(sha1Hash)
}
}
tasks.build { dependsOn("shadowJar") }
tasks.test { useJUnitPlatform() }
application {
mainClass.set("team.ktusers.jam.JamKt")
}
kotlin {
jvmToolchain(21)
compilerOptions.freeCompilerArgs.add("-Xcontext-receivers")
}
sourceSets {
main {
kotlin {
srcDirs("src/main/kotlin", "src/generated/kotlin")
}
}
}