Skip to content

Commit b131f63

Browse files
committed
Exclude debug diagnostics from reporting in examples with hosts
1 parent 37b26ef commit b131f63

File tree

3 files changed

+12
-3
lines changed
  • jvm/basic
    • jvm-embeddable-host/src/main/kotlin/org/jetbrains/kotlin/script/examples/jvm/embeddable/host
    • jvm-maven-deps/host/src/main/kotlin/org/jetbrains/kotlin/script/examples/jvm/resolve/maven/host
    • jvm-simple-script/host/src/main/kotlin/org/jetbrains/kotlin/script/examples/jvm/simple/host

3 files changed

+12
-3
lines changed

jvm/basic/jvm-embeddable-host/src/main/kotlin/org/jetbrains/kotlin/script/examples/jvm/embeddable/host/host.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import org.jetbrains.kotlin.script.examples.jvm.simple.SimpleScript
88
import java.io.File
99
import kotlin.script.experimental.api.EvaluationResult
1010
import kotlin.script.experimental.api.ResultWithDiagnostics
11+
import kotlin.script.experimental.api.ScriptDiagnostic
1112
import kotlin.script.experimental.host.toScriptSource
1213
import kotlin.script.experimental.jvm.dependenciesFromCurrentContext
1314
import kotlin.script.experimental.jvm.jvm
@@ -38,7 +39,9 @@ fun main(vararg args: String) {
3839
val res = evalFile(scriptFile)
3940

4041
res.reports.forEach {
41-
println(" : ${it.message}" + if (it.exception == null) "" else ": ${it.exception}")
42+
if (it.severity > ScriptDiagnostic.Severity.DEBUG) {
43+
println(" : ${it.message}" + if (it.exception == null) "" else ": ${it.exception}")
44+
}
4245
}
4346
}
4447
}

jvm/basic/jvm-maven-deps/host/src/main/kotlin/org/jetbrains/kotlin/script/examples/jvm/resolve/maven/host/host.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.script.examples.jvm.resolve.maven.ScriptWithMavenDep
99
import java.io.File
1010
import kotlin.script.experimental.api.EvaluationResult
1111
import kotlin.script.experimental.api.ResultWithDiagnostics
12+
import kotlin.script.experimental.api.ScriptDiagnostic
1213
import kotlin.script.experimental.host.toScriptSource
1314
import kotlin.script.experimental.jvmhost.BasicJvmScriptingHost
1415
import kotlin.script.experimental.jvmhost.createJvmCompilationConfigurationFromTemplate
@@ -30,7 +31,9 @@ fun main(vararg args: String) {
3031
val res = evalFile(scriptFile)
3132

3233
res.reports.forEach {
33-
println(" : ${it.message}" + if (it.exception == null) "" else ": ${it.exception}")
34+
if (it.severity > ScriptDiagnostic.Severity.DEBUG) {
35+
println(" : ${it.message}" + if (it.exception == null) "" else ": ${it.exception}")
36+
}
3437
}
3538
}
3639
}

jvm/basic/jvm-simple-script/host/src/main/kotlin/org/jetbrains/kotlin/script/examples/jvm/simple/host/host.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.script.examples.jvm.simple.SimpleScript
99
import java.io.File
1010
import kotlin.script.experimental.api.EvaluationResult
1111
import kotlin.script.experimental.api.ResultWithDiagnostics
12+
import kotlin.script.experimental.api.ScriptDiagnostic
1213
import kotlin.script.experimental.host.toScriptSource
1314
import kotlin.script.experimental.jvm.dependenciesFromClassloader
1415
import kotlin.script.experimental.jvm.dependenciesFromCurrentContext
@@ -49,7 +50,9 @@ fun main(vararg args: String) {
4950
val res = evalFile(scriptFile)
5051

5152
res.reports.forEach {
52-
println(" : ${it.message}" + if (it.exception == null) "" else ": ${it.exception}")
53+
if (it.severity > ScriptDiagnostic.Severity.DEBUG) {
54+
println(" : ${it.message}" + if (it.exception == null) "" else ": ${it.exception}")
55+
}
5356
}
5457
}
5558
}

0 commit comments

Comments
 (0)