mirror of
https://github.com/darksaid98/SiegeEngines.git
synced 2026-12-03 14:38:53 +00:00
build: move to gradle and cleanup
- moved to gradle - removed dependency bloat - add support for 1.21.x
This commit is contained in:
1 parent
744d5d2d71
commit
f48ab38b6a
13 files changed
+959
-148
No files matched your search
@@ -0,0 +1,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.20.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()
|
||||
}
|
||||
Reference in new issue
Block a user