|
|
|
@@ -1,15 +1,13 @@
|
|
|
|
|
repositories {
|
|
|
|
|
mavenCentral()
|
|
|
|
|
gradlePluginPortal()
|
|
|
|
|
maven("https://repo.papermc.io/repository/maven-public/")
|
|
|
|
|
maven("https://repo.jpenilla.xyz/snapshots/")
|
|
|
|
|
}
|
|
|
|
|
import xyz.jpenilla.resourcefactory.bukkit.BukkitPluginYaml
|
|
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
|
java
|
|
|
|
|
eclipse
|
|
|
|
|
`java-library`
|
|
|
|
|
id("io.papermc.paperweight.userdev") version "1.7.2"
|
|
|
|
|
id("xyz.jpenilla.run-paper") version "2.3.0" // Adds runServer and runMojangMappedServer tasks for testing
|
|
|
|
|
id("xyz.jpenilla.resource-factory-bukkit-convention") version "1.1.1" // Generates plugin.yml based on the Gradle config
|
|
|
|
|
|
|
|
|
|
// Shades and relocates dependencies into our plugin jar. See https://imperceptiblethoughts.com/shadow/introduction/
|
|
|
|
|
id("io.github.goooler.shadow") version "8.1.7"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
group = "io.papermc.paperweight"
|
|
|
|
@@ -17,26 +15,68 @@ version = "1.0.0-SNAPSHOT"
|
|
|
|
|
description = "Test plugin for paperweight-userdev"
|
|
|
|
|
|
|
|
|
|
java {
|
|
|
|
|
// Use JDK 17 for 1.19.4 compatibility
|
|
|
|
|
toolchain.languageVersion = JavaLanguageVersion.of(17)
|
|
|
|
|
// Configure the java toolchain. This allows gradle to auto-provision JDK 21 on systems that only have JDK 11 installed for example.
|
|
|
|
|
toolchain.languageVersion = JavaLanguageVersion.of(21)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 1)
|
|
|
|
|
// For >=1.20.5 when you don't care about supporting spigot
|
|
|
|
|
// paperweight.reobfArtifactConfiguration = io.papermc.paperweight.userdev.ReobfArtifactConfiguration.MOJANG_PRODUCTION
|
|
|
|
|
|
|
|
|
|
// 2)
|
|
|
|
|
// For 1.20.4 or below, or when you care about supporting Spigot on >=1.20.5
|
|
|
|
|
// Configure reobfJar to run when invoking the build task
|
|
|
|
|
/*
|
|
|
|
|
tasks.assemble {
|
|
|
|
|
dependsOn(tasks.reobfJar)
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
// Use the Paper 1.19.4 dev bundle
|
|
|
|
|
paperweight.paperDevBundle("1.19.4-R0.1-SNAPSHOT")
|
|
|
|
|
paperweight.paperDevBundle("1.21-R0.1-SNAPSHOT")
|
|
|
|
|
// paperweight.foliaDevBundle("1.21-R0.1-SNAPSHOT")
|
|
|
|
|
// paperweight.devBundle("com.example.paperfork", "1.21-R0.1-SNAPSHOT")
|
|
|
|
|
|
|
|
|
|
// Shadow will include the runtimeClasspath by default, which implementation adds to.
|
|
|
|
|
// Dependencies you don't want to include go in the compileOnly configuration.
|
|
|
|
|
// Make sure to relocate shaded dependencies!
|
|
|
|
|
implementation("org.incendo", "cloud-paper", "2.0.0-beta.8")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tasks {
|
|
|
|
|
compileJava {
|
|
|
|
|
options.release.set(17) // Set Java version to 17
|
|
|
|
|
}
|
|
|
|
|
compileJava {
|
|
|
|
|
// Set the release flag. This configures what version bytecode the compiler will emit, as well as what JDK APIs are usable.
|
|
|
|
|
// See https://openjdk.java.net/jeps/247 for more information.
|
|
|
|
|
options.release = 21
|
|
|
|
|
}
|
|
|
|
|
javadoc {
|
|
|
|
|
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
javadoc {
|
|
|
|
|
options.encoding = Charsets.UTF_8.name()
|
|
|
|
|
}
|
|
|
|
|
// Only relevant when going with option 2 above
|
|
|
|
|
/*
|
|
|
|
|
reobfJar {
|
|
|
|
|
// This is an example of how you might change the output location for reobfJar. It's recommended not to do this
|
|
|
|
|
// for a variety of reasons, however it's asked frequently enough that an example of how to do it is included here.
|
|
|
|
|
outputJar = layout.buildDirectory.file("libs/PaperweightTestPlugin-${project.version}.jar")
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
reobfJar {
|
|
|
|
|
outputJar.set(layout.buildDirectory.file("libs/PaperweightTestPlugin-${project.version}.jar"))
|
|
|
|
|
}
|
|
|
|
|
shadowJar {
|
|
|
|
|
// helper function to relocate a package into our package
|
|
|
|
|
fun reloc(pkg: String) = relocate(pkg, "io.papermc.paperweight.testplugin.dependency.$pkg")
|
|
|
|
|
|
|
|
|
|
// relocate cloud and it's transitive dependencies
|
|
|
|
|
reloc("org.incendo.cloud")
|
|
|
|
|
reloc("io.leangen.geantyref")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Configure plugin.yml generation
|
|
|
|
|
// - name, version, and description are inherited from the Gradle project.
|
|
|
|
|
bukkitPluginYaml {
|
|
|
|
|
main = "io.papermc.paperweight.testplugin.TestPlugin"
|
|
|
|
|
load = BukkitPluginYaml.PluginLoadOrder.STARTUP
|
|
|
|
|
authors.add("Author")
|
|
|
|
|
apiVersion = "1.21"
|
|
|
|
|
}
|