-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
96 lines (80 loc) · 2.79 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 java.util.*
plugins {
alias(libs.plugins.runPaper)
alias(libs.plugins.shadow)
alias(libs.plugins.bukkitPluginYAML)
alias(libs.plugins.indra)
}
val pluginName = findProperty("pluginName").toString()
val pluginDescription = findProperty("pluginDescription")?.toString()
val pluginWebsite = findProperty("pluginWebsite")?.toString()
if (pluginName.isEmpty()) {
throw GradleException("The pluginName property cannot be empty")
}
repositories {
maven("https://repo.papermc.io/repository/maven-public/")
}
dependencies {
implementation(project(":api"))
implementation(libs.guice)
compileOnly(libs.paper) {
// Excluded so that we do not import the wrong @Inject class.
// Guice for some reason does not follow javax.inject annotations,
// and any fields annotated with it will end up as null.
exclude(group = "javax.inject", module = "javax.inject")
}
}
tasks {
jar {
finalizedBy("shadowJar")
archiveFileName.set(pluginName + "-" + archiveVersion.get() + "-original.jar")
manifest.attributes(mapOf<String, String>(
"Build-Date" to (Date().toString()),
"Git-Revision" to (if (indraGit.isPresent) (indraGit.commit()?.name() ?: "") else ""),
"Git-Branch" to (if (indraGit.isPresent) indraGit.branchName() ?: "" else ""),
"Build-Number" to (System.getenv("GITHUB_RUN_NUMBER") ?: ""),
"Build-Origin" to (
if (System.getenv("RUNNER_NAME") != null)
"GitHub Actions: " + System.getenv("RUNNER_NAME")
else (System.getProperty("user.name") ?: "Unknown"))
))
}
shadowJar {
archiveFileName.set(pluginName + "-" + archiveVersion.get() + ".jar")
archiveClassifier.set("shaded")
mustRunAfter("build")
mergeServiceFiles()
exclude("META-INF/*.SF")
exclude("META-INF/*.DSA")
exclude("META-INF/*.RSA")
exclude("META-INF/maven/**")
}
runServer {
val ver = findProperty("serverVersion")
if (ver != null) {
minecraftVersion(ver.toString())
} else {
minecraftVersion("1.21.3")
}
jvmArgs("-Dcom.mojang.eula.agree=true")
}
}
bukkit {
name = pluginName
description = pluginDescription
version = project.version.toString()
main = "${project.group}.${pluginName}"
website = pluginWebsite
apiVersion = "1.13"
authors = listOf("azurejelly")
commands {
register("sample") {
description = "A sample command!"
aliases = listOf("example")
}
register("minimessage-sample") {
description = "A sample command using MiniMessage!"
aliases = listOf("mm-sample", "mm-example")
}
}
}