-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
96 lines (79 loc) · 2.6 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
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
plugins {
java
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.shadow)
alias(libs.plugins.run.paper)
alias(libs.plugins.resource.factory)
}
group = "dev.nikomaru" //TODO need to change
version = "1.0-SNAPSHOT" //Don't change
fun captureVersion(dependency: Dependency): String {
return dependency.version ?: throw IllegalArgumentException("Version not found for $dependency")
}
repositories {
mavenCentral()
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://oss.sonatype.org/content/groups/public/")
maven("https://oss.sonatype.org/content/repositories/snapshots/")
maven("https://jitpack.io")
maven("https://plugins.gradle.org/m2/")
maven("https://repo.incendo.org/content/repositories/snapshots")
maven("https://repo.codemc.io/repository/maven-public/")
}
dependencies {
compileOnly(libs.paper.api)
implementation(kotlin("stdlib"))
implementation(libs.bundles.commands)
implementation(libs.bundles.coroutines)
implementation(libs.serialization.json)
implementation(libs.koin.core)
}
kotlin {
jvmToolchain {
(this).languageVersion.set(JavaLanguageVersion.of(21))
}
jvmToolchain(21)
}
tasks {
compileKotlin {
compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
compilerOptions.javaParameters = true
compilerOptions.languageVersion.set(KotlinVersion.KOTLIN_2_0)
}
compileTestKotlin {
compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
}
build {
dependsOn(shadowJar)
}
runServer {
minecraftVersion("1.21")
}
withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
}
}
sourceSets.main {
resourceFactory {
bukkitPluginYaml {
name = rootProject.name
version = "versionPlaceholder" //Don't change
website = "https://github.com/Nlkomaru/PluginTemplate" //TODO need to change
main = "$group.template.Template" //TODO need to change
apiVersion = "1.20"
libraries = libs.bundles.coroutines.asString()
}
}
}
fun Provider<MinimalExternalModuleDependency>.asString(): String {
val dependency = this.get()
return dependency.module.toString() + ":" + dependency.versionConstraint.toString()
}
fun Provider<ExternalModuleDependencyBundle>.asString(): List<String> {
return this.get().map { dependency ->
"${dependency.group}:${dependency.name}:${dependency.version}"
}
}