fix log4j configuration
All checks were successful
Publish to snapshot maven / build (push) Successful in 19s

This commit is contained in:
moehreag 2024-05-20 18:19:50 +02:00
parent baca7dba8e
commit 17c4cf3a56
5 changed files with 20 additions and 6 deletions

View file

@ -29,7 +29,7 @@ class NonsenseGradlePlugin : Plugin<Project> {
nonsenseCacheDir.createDirectories() nonsenseCacheDir.createDirectories()
project.apply { project.apply {
mapOf("plugin" to "java") mapOf("plugin" to "java-library")
mapOf("plugin" to "eclipse") mapOf("plugin" to "eclipse")
mapOf("plugin" to "idea") mapOf("plugin" to "idea")
mapOf("plugin" to "maven-publish") mapOf("plugin" to "maven-publish")

View file

@ -37,6 +37,8 @@ fun Project.minecraft(
NonsenseRemapper.remap(data, clientJar, remappedJar, true, paramMappings) NonsenseRemapper.remap(data, clientJar, remappedJar, true, paramMappings)
} }
println("Adding dependencies...") println("Adding dependencies...")
//configurations.getByName("development").extendsFrom(configurations.getByName("implementation"))
dependencies.add("implementation","net.minecrell:terminalconsoleappender:1.2.0")
VersionChecker.getDependencies(version) { VersionChecker.getDependencies(version) {
dependencies.add("implementation", it) dependencies.add("implementation", it)
} }

View file

@ -6,6 +6,7 @@ import org.ecorous.esnesnon.gradle.common.Env
import org.ecorous.esnesnon.gradle.run.adapter.EclipseAdapter import org.ecorous.esnesnon.gradle.run.adapter.EclipseAdapter
import org.ecorous.esnesnon.gradle.run.adapter.IdeaAdapter import org.ecorous.esnesnon.gradle.run.adapter.IdeaAdapter
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.logging.configuration.ConsoleOutput
import java.nio.file.Files import java.nio.file.Files
import kotlin.io.path.absolute import kotlin.io.path.absolute
import kotlin.io.path.createDirectories import kotlin.io.path.createDirectories
@ -45,12 +46,17 @@ object RunConfigGenerator {
project, project,
"Minecraft ${env.pascalName}", "Minecraft ${env.pascalName}",
"org.ecorous.esnesnon.nonsense.loader.impl.launch.${env.id}.Nonsense${env.pascalName}", "org.ecorous.esnesnon.nonsense.loader.impl.launch.${env.id}.Nonsense${env.pascalName}",
arrayOf( mutableListOf(
"-Xmx${project.properties.getOrDefault("nonsense.gameHeap", "2048M")}", "-Xmx${project.properties.getOrDefault("nonsense.gameHeap", "2048M")}",
"-Dnonsense.development=true", "-Dnonsense.development=true",
"-Dnonsense.plugin.minecraft.gameJar=${NonsenseGradlePlugin.remappedGameJarPath}", "-Dnonsense.plugin.minecraft.gameJar=${NonsenseGradlePlugin.remappedGameJarPath}",
"-Dlog4j2.configurationFile=$log4jPath" "-Dlog4j2.configurationFile=$log4jPath",
), if (env == Env.CLIENT) { "-Dlog4j2.formatMsgLookups=true"
).apply {
if (project.gradle.startParameter.consoleOutput != ConsoleOutput.Plain){
add("-Dnonsense.log.disableAnsi=false")
}
}.toTypedArray(), if (env == Env.CLIENT) {
arrayOf( arrayOf(
"--assetsDir", assetPath.toString(), "--assetsDir", assetPath.toString(),
"--version", "Nonsense", "--version", "Nonsense",

View file

@ -5,6 +5,7 @@ import org.ecorous.esnesnon.gradle.VersionChecker
import org.ecorous.esnesnon.gradle.common.Env import org.ecorous.esnesnon.gradle.common.Env
import org.gradle.api.file.ConfigurableFileCollection import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileCollection import org.gradle.api.file.FileCollection
import org.gradle.api.logging.configuration.ConsoleOutput
import org.gradle.api.plugins.JavaPluginExtension import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.tasks.JavaExec import org.gradle.api.tasks.JavaExec
import org.gradle.api.tasks.SourceSet import org.gradle.api.tasks.SourceSet
@ -56,9 +57,14 @@ abstract class RunGameTask @Inject constructor(env: Env) : JavaExec() {
"-Dnonsense.development=true", "-Dnonsense.development=true",
"-Dnonsense.plugin.minecraft.gameJar=${NonsenseGradlePlugin.remappedGameJarPath}", "-Dnonsense.plugin.minecraft.gameJar=${NonsenseGradlePlugin.remappedGameJarPath}",
"-Dlog4j2.configurationFile=$log4jPath", "-Dlog4j2.configurationFile=$log4jPath",
"-Dlog4j2.formatMsgNoLookups=true",
writeArgFile() writeArgFile()
) )
if (project.gradle.startParameter.consoleOutput != ConsoleOutput.Plain){
jvmArguments.add("-Dnonsense.log.disableAnsi=false")
}
mainClass.set("org.ecorous.esnesnon.nonsense.loader.impl.launch.${env.id}.Nonsense${env.pascalName}") mainClass.set("org.ecorous.esnesnon.nonsense.loader.impl.launch.${env.id}.Nonsense${env.pascalName}")
} }

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" packages="com.mojang.util"> <Configuration status="WARN">
<Appenders> <Appenders>
<!-- System out --> <!-- System out -->
@ -11,7 +11,7 @@
<RegexFilter regex="^Couldn't connect to realms$" onMatch="DENY" onMismatch="NEUTRAL"/> <RegexFilter regex="^Couldn't connect to realms$" onMatch="DENY" onMismatch="NEUTRAL"/>
</Filters> </Filters>
<PatternLayout> <PatternLayout>
<LoggerNamePatternSelector defaultPattern="%style{[%d{HH:mm:ss}]}{blue} %highlight{[%t/%level]}{FATAL=red, ERROR=red, WARN=yellow, INFO=green, DEBUG=green, TRACE=blue} %style{(%logger{1})}{cyan} %highlight{%msg%n}{FATAL=red, ERROR=red, WARN=normal, INFO=normal, DEBUG=normal, TRACE=normal}" disableAnsi="${sys:fabric.log.disableAnsi:-true}"> <LoggerNamePatternSelector defaultPattern="%style{[%d{HH:mm:ss}]}{blue} %highlight{[%t/%level]}{FATAL=red, ERROR=red, WARN=yellow, INFO=green, DEBUG=green, TRACE=blue} %style{(%logger{1})}{cyan} %highlight{%msg%n}{FATAL=red, ERROR=red, WARN=normal, INFO=normal, DEBUG=normal, TRACE=normal}" disableAnsi="${sys:nonsense.log.disableAnsi:-true}">
<!-- Dont show the logger name for minecraft classes--> <!-- Dont show the logger name for minecraft classes-->
<PatternMatch key="net.minecraft.,com.mojang." pattern="%style{[%d{HH:mm:ss}]}{blue} %highlight{[%t/%level]}{FATAL=red, ERROR=red, WARN=yellow, INFO=green, DEBUG=green, TRACE=blue} %style{(Minecraft)}{cyan} %highlight{%msg{nolookups}%n}{FATAL=red, ERROR=red, WARN=normal, INFO=normal, DEBUG=normal, TRACE=normal}"/> <PatternMatch key="net.minecraft.,com.mojang." pattern="%style{[%d{HH:mm:ss}]}{blue} %highlight{[%t/%level]}{FATAL=red, ERROR=red, WARN=yellow, INFO=green, DEBUG=green, TRACE=blue} %style{(Minecraft)}{cyan} %highlight{%msg{nolookups}%n}{FATAL=red, ERROR=red, WARN=normal, INFO=normal, DEBUG=normal, TRACE=normal}"/>
</LoggerNamePatternSelector> </LoggerNamePatternSelector>