Scripting: avoid proguarding of slf4j libs in main-kts
slf4j libs are bundled unshadowed to main-kts jar to avoid annoying slf4j stderr printout (slf4j is used in the maven dependencies resolver) Exluding it from proguard processing solves problems with using it directly from scripts. #KT-60813 fixed #KT-54819 fixed
This commit is contained in:
committed by
Space Team
parent
a47ee44e65
commit
932b5bf8cd
+6
@@ -158,6 +158,12 @@ class MainKtsIT {
|
|||||||
Assert.assertTrue("Expect file '$scriptPath' to start with UTF-8 BOM", File(scriptPath).readText().startsWith(UTF8_BOM))
|
Assert.assertTrue("Expect file '$scriptPath' to start with UTF-8 BOM", File(scriptPath).readText().startsWith(UTF8_BOM))
|
||||||
runWithKotlincAndMainKts(scriptPath, listOf("Hello world"))
|
runWithKotlincAndMainKts(scriptPath, listOf("Hello world"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testUseSlf4j() {
|
||||||
|
val scriptPath = "$TEST_DATA_ROOT/use-slf4j.main.kts"
|
||||||
|
runWithKotlincAndMainKts(scriptPath, expectedErrPatterns = listOf(".*test-slf4j"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun runWithKotlincAndMainKts(
|
fun runWithKotlincAndMainKts(
|
||||||
|
|||||||
+12
@@ -274,6 +274,18 @@ class MainKtsTest {
|
|||||||
assertSucceeded(res)
|
assertSucceeded(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testUseSlf4j() {
|
||||||
|
val err = captureOutAndErr {
|
||||||
|
val res = evalFile(File("$TEST_DATA_ROOT/use-slf4j.main.kts"))
|
||||||
|
assertSucceeded(res)
|
||||||
|
}.second
|
||||||
|
Assert.assertTrue(
|
||||||
|
"Expect info log line with \"test-slf4j\" text, got:\n$err",
|
||||||
|
err.contains("INFO - test-slf4j")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private fun assertSucceeded(res: ResultWithDiagnostics<EvaluationResult>) {
|
private fun assertSucceeded(res: ResultWithDiagnostics<EvaluationResult>) {
|
||||||
Assert.assertTrue(
|
Assert.assertTrue(
|
||||||
"test failed:\n ${res.reports.joinToString("\n ") { it.severity.name + ": " + it.message + if (it.exception == null) "" else ": ${it.exception}" }}",
|
"test failed:\n ${res.reports.joinToString("\n ") { it.severity.name + ": " + it.message + if (it.exception == null) "" else ": ${it.exception}" }}",
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
@file:DependsOn("org.slf4j:slf4j-api:1.7.36")
|
||||||
|
@file:DependsOn("org.slf4j:slf4j-simple:1.7.36")
|
||||||
|
|
||||||
|
val logger = org.slf4j.LoggerFactory.getLogger("")
|
||||||
|
logger.info("test-{}", "slf4j" as Any)
|
||||||
@@ -34,6 +34,9 @@
|
|||||||
-keep class org.apache.maven.wagon.providers.** { *; }
|
-keep class org.apache.maven.wagon.providers.** { *; }
|
||||||
-keep class org.jetbrains.kotlin.org.apache.maven.wagon.providers.** { *; }
|
-keep class org.jetbrains.kotlin.org.apache.maven.wagon.providers.** { *; }
|
||||||
|
|
||||||
|
-keep class org.slf4j.** { *; }
|
||||||
|
-keep class org.jetbrains.kotlin.org.slf4j.** { *; }
|
||||||
|
|
||||||
-keepclassmembers class * extends java.lang.Enum {
|
-keepclassmembers class * extends java.lang.Enum {
|
||||||
<fields>;
|
<fields>;
|
||||||
**[] values();
|
**[] values();
|
||||||
|
|||||||
Reference in New Issue
Block a user