Skip to content

Commit 82b0e0f

Browse files
committed
Fix logback file copy
1 parent 72da556 commit 82b0e0f

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

game/build.gradle.kts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2-
import kotlin.math.log
32

43
plugins {
54
application
@@ -69,16 +68,6 @@ tasks {
6968
named<ShadowJar>("shadowJar") {
7069
dependsOn("collectSourcePaths")
7170
from(layout.buildDirectory.file("scripts.txt"))
72-
// Replace logback file as the custom colour classes can't be individually excluded from minimization
73-
// https://github.com/GradleUp/shadow/issues/638
74-
exclude("logback.xml")
75-
val logback = layout.buildDirectory.file("resources/main/logback.xml")
76-
.get().asFile.readText()
77-
.replace("%colour", "%highlight")
78-
.replace("%message(%msg){}", "%msg")
79-
val asFile = layout.buildDirectory.file("logback-test.xml").get().asFile
80-
asFile.writeText(logback)
81-
from(asFile)
8271
minimize {
8372
exclude("world/gregs/voidps/engine/log/**")
8473
exclude(dependency("org.postgresql:postgresql:.*"))
@@ -88,6 +77,18 @@ tasks {
8877
archiveBaseName.set("void-server-${version}")
8978
archiveClassifier.set("")
9079
archiveVersion.set("")
80+
// Replace logback file as the custom colour classes can't be individually excluded from minimization
81+
// https://github.com/GradleUp/shadow/issues/638
82+
exclude("logback.xml")
83+
val resourcesDir = layout.projectDirectory.dir("src/main/resources")
84+
val logback = resourcesDir.file("logback.xml").asFile
85+
.readText()
86+
.replace("%colour", "%highlight")
87+
.replace("%message(%msg){}", "%msg")
88+
val replacement = layout.buildDirectory.file("logback-test.xml").get().asFile
89+
replacement.parentFile.mkdirs()
90+
replacement.writeText(logback)
91+
from(replacement)
9192
}
9293

9394
withType<Test> {

0 commit comments

Comments
 (0)