From ebbe51cd1c6c26c668db55f04f6394b5dc64e716 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Sun, 14 Nov 2021 16:16:00 -0800 Subject: [PATCH] Shade and relocate cloud --- build.gradle.kts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 3ba67eed..2f6f2446 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,6 +5,9 @@ plugins { id("io.papermc.paperweight.userdev") version "2.0.0-beta.13" id("xyz.jpenilla.run-paper") version "2.3.1" // Adds runServer and runMojangMappedServer tasks for testing id("xyz.jpenilla.resource-factory-bukkit-convention") version "1.2.0" // Generates plugin.yml based on the Gradle config + + // Shades and relocates dependencies into our plugin jar. See https://imperceptiblethoughts.com/shadow/introduction/ + id("com.gradleup.shadow") version "8.3.5" } group = "io.papermc.paperweight" @@ -29,6 +32,11 @@ dependencies { paperweight.paperDevBundle("1.21.4-R0.1-SNAPSHOT") // paperweight.foliaDevBundle("1.21.4-R0.1-SNAPSHOT") // paperweight.devBundle("com.example.paperfork", "1.21.4-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.10") } tasks { @@ -49,6 +57,15 @@ tasks { outputJar = 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