From 0eec65c1880396a0ba105a58eccea30fa7d08eec Mon Sep 17 00:00:00 2001 From: onebeastchris Date: Thu, 31 Oct 2024 18:24:54 +0800 Subject: [PATCH] Fix: Geyser-NeoForge complaining about jackson --- bootstrap/mod/fabric/build.gradle.kts | 1 - bootstrap/mod/neoforge/build.gradle.kts | 14 ++++++++++++++ ...eyser.modrinth-uploading-conventions.gradle.kts | 1 + gradle/libs.versions.toml | 5 +++-- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/bootstrap/mod/fabric/build.gradle.kts b/bootstrap/mod/fabric/build.gradle.kts index 56bec322e..2599a47b5 100644 --- a/bootstrap/mod/fabric/build.gradle.kts +++ b/bootstrap/mod/fabric/build.gradle.kts @@ -46,7 +46,6 @@ tasks.withType { relocate("org.cloudburstmc.netty") relocate("org.cloudburstmc.protocol") -relocate("com.github.steveice10.mc.auth") tasks { remapJar { diff --git a/bootstrap/mod/neoforge/build.gradle.kts b/bootstrap/mod/neoforge/build.gradle.kts index 4ab005b4f..23f16d64e 100644 --- a/bootstrap/mod/neoforge/build.gradle.kts +++ b/bootstrap/mod/neoforge/build.gradle.kts @@ -13,6 +13,9 @@ architectury { provided("org.cloudburstmc.math", "api") provided("com.google.errorprone", "error_prone_annotations") +// Jackson shipped by Minecraft is too old, so we shade & relocate our newer version +relocate("com.fasterxml.jackson") + val includeTransitive: Configuration = configurations.getByName("includeTransitive") dependencies { @@ -31,6 +34,12 @@ dependencies { } shadow(projects.core) { isTransitive = false } + // Minecraft (1.21.2+) includes jackson. But an old version! + shadow(libs.jackson.core) { isTransitive = false } + shadow(libs.jackson.databind) { isTransitive = false } + shadow(libs.jackson.dataformat.yaml) { isTransitive = false } + shadow(libs.jackson.annotations) { isTransitive = false } + // Let's shade in our own api shadow(projects.api) { isTransitive = false } @@ -56,6 +65,11 @@ tasks { remapModrinthJar { archiveBaseName.set("geyser-neoforge") } + + shadowJar { + // Without this, jackson's service files are not relocated + mergeServiceFiles() + } } modrinth { diff --git a/build-logic/src/main/kotlin/geyser.modrinth-uploading-conventions.gradle.kts b/build-logic/src/main/kotlin/geyser.modrinth-uploading-conventions.gradle.kts index 3c0d102f7..59f85d182 100644 --- a/build-logic/src/main/kotlin/geyser.modrinth-uploading-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/geyser.modrinth-uploading-conventions.gradle.kts @@ -7,6 +7,7 @@ tasks.modrinth.get().dependsOn(tasks.modrinthSyncBody) modrinth { token.set(System.getenv("MODRINTH_TOKEN") ?: "") // Even though this is the default value, apparently this prevents GitHub Actions caching the token? + debugMode.set(System.getenv("MODRINTH_TOKEN") == null) projectId.set("geyser") versionName.set(versionName(project)) versionNumber.set(projectVersion(project)) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9031799cf..60fe78448 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -60,7 +60,8 @@ erosion-bukkit-nms = { group = "org.geysermc.erosion", name = "bukkit-nms", vers erosion-common = { group = "org.geysermc.erosion", name = "common", version.ref = "erosion" } jackson-annotations = { group = "com.fasterxml.jackson.core", name = "jackson-annotations", version.ref = "jackson" } -jackson-core = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jackson" } +jackson-databind = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jackson" } +jackson-core = { group = "com.fasterxml.jackson.core", name = "jackson-core", version.ref = "jackson" } jackson-dataformat-yaml = { group = "com.fasterxml.jackson.dataformat", name = "jackson-dataformat-yaml", version.ref = "jackson" } fastutil-int-int-maps = { group = "com.nukkitx.fastutil", name = "fastutil-int-int-maps", version.ref = "fastutil" } @@ -150,7 +151,7 @@ indra = { id = "net.kyori.indra", version.ref = "indra" } blossom = { id = "net.kyori.blossom", version.ref = "blossom" } [bundles] -jackson = [ "jackson-annotations", "jackson-core", "jackson-dataformat-yaml" ] +jackson = [ "jackson-annotations", "jackson-databind", "jackson-dataformat-yaml" ] fastutil = [ "fastutil-int-int-maps", "fastutil-int-long-maps", "fastutil-int-byte-maps", "fastutil-int-boolean-maps", "fastutil-object-int-maps", "fastutil-object-object-maps" ] adventure = [ "adventure-text-serializer-gson", "adventure-text-serializer-legacy", "adventure-text-serializer-plain" ] log4j = [ "log4j-api", "log4j-core", "log4j-slf4j2-impl" ]