feat(minecraft): Setup logging for older Minecraft/Log4J2 versions

This commit is contained in:
2025-11-03 02:43:49 +01:00
parent bd518275f7
commit 6f870ffaab
3 changed files with 35 additions and 0 deletions

View File

@@ -12,6 +12,12 @@ val bundledSourcesConfiguration = configurations.resolvable("bundledSources") {
}
}
configurations.implementation {
exclude(group = "commons-logging", module = "commons-logging")
}
val vendoredCommonsLogging = project.layout.settingsDirectory.file("vendor/commons-logging").asFile
dependencies {
implementation("de.siphalor.tweed5:tweed5-core")
implementation("de.siphalor.tweed5:tweed5-attributes-extension")
@@ -22,10 +28,35 @@ dependencies {
implementation("de.siphalor.tweed5:tweed5-weaver-pojo-presets-extension")
implementation("de.siphalor.tweed5:tweed5-weaver-pojo-serde-extension")
implementation("de.siphalor.tweed5:tweed5-weaver-pojo-validation-extension")
implementation(
objects.fileCollection().apply {
from(
vendoredCommonsLogging.resolve("target")
.listFiles { it.name.endsWith("SNAPSHOT.jar") }
)
builtBy("compileCommonsLogging")
}
)
}
tasks.register<Exec>("compileCommonsLogging") {
inputs.file(vendoredCommonsLogging.resolve("pom.xml"))
inputs.dir(vendoredCommonsLogging.resolve("src"))
outputs.dir(vendoredCommonsLogging.resolve("target"))
commandLine("mvn", "package", "-DskipTests")
workingDir(vendoredCommonsLogging)
}
tasks.shadowJar {
relocate("org.objectweb.asm", "de.siphalor.tweed5.shadowed.org.objectweb.asm")
relocate("META-INF", "META-INF/tweed5-vendored/commons-logging") {
include("META-INF/*.txt")
}
exclude("META-INF/maven/**")
// Remove some obsolete classes
exclude("org/apache/commons/logging/impl/WeakHashtable*")
}
tasks.register<BundledSourcesJar>("sourcesJar") {