forked from TheCrunchy/CrunchSiegeEquipment
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
129 lines (103 loc) · 4.04 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import java.time.Instant
plugins {
`java-library`
alias(libs.plugins.shadow) // Shades and relocates dependencies, see https://gradleup.com/shadow/
alias(libs.plugins.run.paper) // Built in test server using runServer and runMojangMappedServer tasks
alias(libs.plugins.plugin.yml) // Automatic plugin.yml generation
eclipse
idea
}
val mainPackage = "${project.group}.${project.name.lowercase()}"
applyCustomVersion()
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17)) // Configure the java toolchain. This allows gradle to auto-provision JDK 21 on systems that only have JDK 8 installed for example.
withJavadocJar()
withSourcesJar()
}
repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://maven.athyrium.eu/releases")
}
dependencies {
// Core dependencies
compileOnly(libs.annotations)
annotationProcessor(libs.annotations)
compileOnly(libs.paper.api)
// API
implementation(libs.colorparser) {
exclude("org.intellij.lang.annotations")
exclude("org.jetbrains.lang.annotations")
exclude("net.kyori")
}
implementation(libs.commandapi.shade)
}
tasks {
build {
dependsOn(shadowJar)
}
compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
options.compilerArgs.addAll(arrayListOf("-Xlint:all", "-Xlint:-processing", "-Xdiags:verbose"))
}
javadoc {
isFailOnError = false
val options = options as StandardJavadocDocletOptions
options.encoding = Charsets.UTF_8.name()
options.overview = "src/main/javadoc/overview.html"
options.windowTitle = "${rootProject.name} Javadoc"
options.tags("apiNote:a:API Note:", "implNote:a:Implementation Note:", "implSpec:a:Implementation Requirements:")
options.addStringOption("Xdoclint:none", "-quiet")
options.use()
}
processResources {
filteringCharset = Charsets.UTF_8.name()
}
shadowJar {
archiveBaseName.set(project.name)
archiveClassifier.set("")
// Shadow classes
fun reloc(originPkg: String, targetPkg: String) = relocate(originPkg, "${mainPackage}.lib.${targetPkg}")
reloc("com.github.milkdrinkers.colorparser", "colorparser")
reloc("dev.jorel.commandapi", "commandapi")
minimize()
exclude("META-INF/**")
}
test {
useJUnitPlatform()
failFast = false
}
runServer {
// Configure the Minecraft version for our task.
minecraftVersion("1.21.4")
// IntelliJ IDEA debugger setup: https://docs.papermc.io/paper/dev/debugging#using-a-remote-debugger
jvmArgs("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005", "-DPaper.IgnoreJavaVersion=true", "-Dcom.mojang.eula.agree=true", "-DIReallyKnowWhatIAmDoingISwear", "-Dpaper.playerconnection.keepalive=6000")
systemProperty("terminal.jline", false)
systemProperty("terminal.ansi", true)
// Automatically install dependencies
downloadPlugins {}
}
}
bukkit { // Options: https://github.com/Minecrell/plugin-yml#bukkit
// Plugin main class (required)
main = "${mainPackage}.${project.name}"
// Plugin Information
name = project.name
prefix = project.name
version = "${project.version}"
description = "${project.description}"
authors = listOf("ShermansWorld", "C_Corp2002", "TheCrunchy")
contributors = listOf("darksaid98")
apiVersion = "1.20"
// Misc properties
load = net.minecrell.pluginyml.bukkit.BukkitPluginDescription.PluginLoadOrder.POSTWORLD // STARTUP or POSTWORLD
depend = listOf()
softDepend = listOf()
}
fun applyCustomVersion() {
// Apply custom version arg or append snapshot version
val ver = properties["altVer"]?.toString() ?: "${rootProject.version}-SNAPSHOT-${Instant.now().epochSecond}"
// Strip prefixed "v" from version tag
rootProject.version = (if (ver.first().equals('v', true)) ver.substring(1) else ver.uppercase()).uppercase()
}