diff --git a/buildSrc/src/main/kotlin/korlibs/korge/gradle/typedresources/TypedResourcesGenerator.kt b/buildSrc/src/main/kotlin/korlibs/korge/gradle/typedresources/TypedResourcesGenerator.kt index 2e77a7934e..4d4aee60e9 100644 --- a/buildSrc/src/main/kotlin/korlibs/korge/gradle/typedresources/TypedResourcesGenerator.kt +++ b/buildSrc/src/main/kotlin/korlibs/korge/gradle/typedresources/TypedResourcesGenerator.kt @@ -24,7 +24,10 @@ class TypedResourcesGenerator { return normalizeName().textCase().camelCase() } - fun generateForFolders(resourcesFolder: SFile): String { + fun generateForFolders(resourcesFolder: SFile, reporter: (e: Throwable, message: String) -> Unit = { e, message -> + System.err.println(message) + e.printStackTrace() + }): String { return Indenter { line("import korlibs.audio.sound.*") line("import korlibs.io.file.*") @@ -146,8 +149,7 @@ class TypedResourcesGenerator { val info = try { ASEInfo.getAseInfo(ase.file.readBytes()) } catch (e: Throwable) { - System.err.println("ERROR LOADING FILE: aseFile=$aseFile") - e.printStackTrace() + reporter(e, "ERROR LOADING FILE: aseFile=$aseFile") ASEInfo() } diff --git a/buildSrc/src/test/kotlin/korlibs/korge/gradle/typedresources/TypedResourcesGeneratorTest.kt b/buildSrc/src/test/kotlin/korlibs/korge/gradle/typedresources/TypedResourcesGeneratorTest.kt index b8f652b7b3..401f9ca386 100644 --- a/buildSrc/src/test/kotlin/korlibs/korge/gradle/typedresources/TypedResourcesGeneratorTest.kt +++ b/buildSrc/src/test/kotlin/korlibs/korge/gradle/typedresources/TypedResourcesGeneratorTest.kt @@ -19,7 +19,9 @@ class TypedResourcesGeneratorTest { "images/image.ase" to "", "images/image2.ase" to "INVALID213123123621639172639127637216", ) - ) + ) { e, message -> + + } fun String.normalize(): String { return this.trimIndent().replace("\t", " ").trim().lines().map { it.trimEnd() }.joinToString("\n")