From 675e70be6673050dc52e0b470960f965566e1f92 Mon Sep 17 00:00:00 2001 From: Konicai <71294714+Konicai@users.noreply.github.com> Date: Sun, 16 Oct 2022 22:47:26 -0400 Subject: [PATCH] Fix shaded jar --- Jenkinsfile | 2 +- bootstrap/fabric/build.gradle.kts | 10 +++++ .../platform/fabric/GeyserFabricMain.java | 45 +++++++++++++++++++ build.gradle.kts | 1 + 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 bootstrap/fabric/src/main/java/org/geysermc/platform/fabric/GeyserFabricMain.java diff --git a/Jenkinsfile b/Jenkinsfile index 0123a2771..065ca48c4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ pipeline { } post { success { - archiveArtifacts artifacts: 'bootstrap/**/build/libs/*.jar', excludes: 'bootstrap/**/build/libs/*-sources.jar,bootstrap/**/build/libs/*-unshaded.jar', fingerprint: true + archiveArtifacts artifacts: 'bootstrap/**/build/libs/Geyser-*.jar', fingerprint: true } } } diff --git a/bootstrap/fabric/build.gradle.kts b/bootstrap/fabric/build.gradle.kts index 7e767afe0..8729e671c 100644 --- a/bootstrap/fabric/build.gradle.kts +++ b/bootstrap/fabric/build.gradle.kts @@ -50,6 +50,10 @@ repositories { maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") } +application { + mainClass.set("org.geysermc.geyser.platform.fabric.GeyserFabricMain") +} + tasks { // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task // if it is present. @@ -60,6 +64,12 @@ tasks { } shadowJar { + // Mirrors the example fabric project, otherwise tons of dependencies are shaded that shouldn't be + configurations = listOf(project.configurations.shadow.get()) + // The remapped shadowJar is the final desired Geyser-Fabric.jar + archiveVersion.set(project.version.toString()) + archiveClassifier.set("shaded") + relocate("org.objectweb.asm", "org.geysermc.relocate.asm") relocate("org.yaml", "org.geysermc.relocate.yaml") // https://github.com/CardboardPowered/cardboard/issues/139 relocate("com.fasterxml.jackson", "org.geysermc.relocate.jackson") diff --git a/bootstrap/fabric/src/main/java/org/geysermc/platform/fabric/GeyserFabricMain.java b/bootstrap/fabric/src/main/java/org/geysermc/platform/fabric/GeyserFabricMain.java new file mode 100644 index 000000000..354dbbf77 --- /dev/null +++ b/bootstrap/fabric/src/main/java/org/geysermc/platform/fabric/GeyserFabricMain.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.platform.fabric; + +import org.geysermc.geyser.GeyserMain; + +public class GeyserFabricMain extends GeyserMain { + + public static void main(String[] args) { + new GeyserFabricMain().displayMessage(); + } + + @Override + public String getPluginType() { + return "Fabric"; + } + + @Override + public String getPluginFolder() { + return "mods"; + } +} diff --git a/build.gradle.kts b/build.gradle.kts index 7371978d3..06c2e987b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,6 +15,7 @@ allprojects { } val platforms = setOf( + projects.fabric, projects.bungeecord, projects.spigot, projects.sponge,