1
0
mirror of https://github.com/GeyserMC/Geyser.git synced 2025-12-19 14:59:27 +00:00

Fix: Build issues for Geyser-Fabric and Geyser-NeoForge

resolves: https://github.com/GeyserMC/Geyser/issues/5718
how did this work until now? we'll never know
This commit is contained in:
onebeastchris
2025-07-26 01:13:25 +02:00
parent 461acb62a9
commit ca99ab7b1b
5 changed files with 32 additions and 35 deletions

View File

@@ -15,26 +15,24 @@ dependencies {
modApi(libs.fabric.api)
api(project(":mod", configuration = "namedElements"))
shadow(project(path = ":mod", configuration = "transformProductionFabric")) {
isTransitive = false
}
shadow(projects.core) { isTransitive = false }
shadowBundle(project(path = ":mod", configuration = "transformProductionFabric"))
shadowBundle(projects.core)
includeTransitive(projects.core)
// These are NOT transitively included, and instead shadowed + relocated.
// Avoids fabric complaining about non-SemVer versioning
shadow(libs.protocol.connection) { isTransitive = false }
shadow(libs.protocol.common) { isTransitive = false }
shadow(libs.protocol.codec) { isTransitive = false }
shadow(libs.raknet) { isTransitive = false }
shadow(libs.mcprotocollib) { isTransitive = false }
shadowBundle(libs.protocol.connection)
shadowBundle(libs.protocol.common)
shadowBundle(libs.protocol.codec)
shadowBundle(libs.raknet)
shadowBundle(libs.mcprotocollib)
// Since we also relocate cloudburst protocol: shade erosion common
shadow(libs.erosion.common) { isTransitive = false }
shadowBundle(libs.erosion.common)
// Let's shade in our own api/common module
shadow(projects.api) { isTransitive = false }
shadow(projects.common) { isTransitive = false }
shadowBundle(projects.api)
shadowBundle(projects.common)
modImplementation(libs.cloud.fabric)
include(libs.cloud.fabric)

View File

@@ -29,19 +29,17 @@ dependencies {
neoForge(libs.neoforge.minecraft)
api(project(":mod", configuration = "namedElements"))
shadow(project(path = ":mod", configuration = "transformProductionNeoForge")) {
isTransitive = false
}
shadow(projects.core) { isTransitive = false }
shadowBundle(project(path = ":mod", configuration = "transformProductionNeoForge"))
shadowBundle(projects.core)
// 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 }
shadowBundle(libs.jackson.core)
shadowBundle(libs.jackson.databind)
shadowBundle(libs.jackson.dataformat.yaml)
shadowBundle(libs.jackson.annotations)
// Let's shade in our own api
shadow(projects.api) { isTransitive = false }
shadowBundle(projects.api)
// cannot be shaded, since neoforge will complain if floodgate-neoforge tries to provide this
include(projects.common)

View File

@@ -34,7 +34,7 @@ tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
exclude(dependency("io.netty:.*"))
exclude(dependency("org.slf4j:.*"))
exclude(dependency("org.ow2.asm:.*"))
// Exclude all Kyori dependencies except the legacy NBT serializer
// Exclude all Kyori dependencies
exclude(dependency("net.kyori:.*:.*"))
}
}

View File

@@ -55,6 +55,11 @@ indra {
configurations {
create("includeTransitive").isTransitive = true
create("shadowBundle") {
isCanBeResolved = true
isCanBeConsumed = false
isTransitive = false
}
}
tasks {
@@ -68,7 +73,7 @@ tasks {
shadowJar {
// Mirrors the example fabric project, otherwise tons of dependencies are shaded that shouldn't be
configurations = listOf(project.configurations.shadow.get())
configurations = listOf(project.configurations.getByName("shadowBundle"))
// The remapped shadowJar is the final desired mod jar
archiveVersion.set(project.version.toString())
archiveClassifier.set("shaded")
@@ -91,17 +96,15 @@ tasks {
afterEvaluate {
val providedDependencies = providedDependencies[project.name]!!
// These are shaded, no need to JiJ them
configurations["shadow"].dependencies.forEach {shadowed ->
//println("Not including shadowed dependency: ${shadowed.group}:${shadowed.name}")
providedDependencies.add("${shadowed.group}:${shadowed.name}")
}
val shadedDependencies = configurations.getByName("shadowBundle")
.dependencies.stream().map { dependency -> "${dependency.group}:${dependency.name}" }.toList()
// Now: Include all transitive dependencies that aren't excluded
configurations["includeTransitive"].resolvedConfiguration.resolvedArtifacts.forEach { dep ->
if (!providedDependencies.contains("${dep.moduleVersion.id.group}:${dep.moduleVersion.id.name}")
and !providedDependencies.contains("${dep.moduleVersion.id.group}:.*")) {
val name = "${dep.moduleVersion.id.group}:${dep.moduleVersion.id.name}"
if (!shadedDependencies.contains(name) and !providedDependencies.contains(name)
and !providedDependencies.contains("${dep.moduleVersion.id.group}:.*")
) {
println("Including dependency via JiJ: ${dep.id}")
dependencies.add("include", dep.moduleVersion.id.toString())
} else {

View File

@@ -28,6 +28,7 @@ package org.geysermc.geyser.network;
import io.netty.channel.Channel;
import io.netty.channel.DefaultEventLoopGroup;
import io.netty.util.concurrent.DefaultThreadFactory;
import lombok.Getter;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.cloudburstmc.protocol.bedrock.BedrockPeer;
import org.cloudburstmc.protocol.bedrock.BedrockServerSession;
@@ -41,16 +42,13 @@ import java.net.InetSocketAddress;
public class GeyserServerInitializer extends BedrockServerInitializer {
private final GeyserImpl geyser;
// There is a constructor that doesn't require inputting threads, but older Netty versions don't have it
@Getter
private final DefaultEventLoopGroup eventLoopGroup = new DefaultEventLoopGroup(0, new DefaultThreadFactory("Geyser player thread"));
public GeyserServerInitializer(GeyserImpl geyser) {
this.geyser = geyser;
}
public DefaultEventLoopGroup getEventLoopGroup() {
return eventLoopGroup;
}
@Override
public void initSession(@NonNull BedrockServerSession bedrockServerSession) {
try {