mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Better error reporting when launching separate kotlinc.
This commit is contained in:
parent
138ba15f3a
commit
224a5d7925
2 changed files with 6 additions and 2 deletions
|
@ -37,6 +37,8 @@ class RunCommandInfo {
|
||||||
|
|
||||||
! hasErrors
|
! hasErrors
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var containsErrors: ((List<String>) -> Boolean)? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun runCommand(init: RunCommandInfo.() -> Unit) = NewRunCommand(RunCommandInfo().apply { init() }).invoke()
|
fun runCommand(init: RunCommandInfo.() -> Unit) = NewRunCommand(RunCommandInfo().apply { init() }).invoke()
|
||||||
|
@ -84,7 +86,9 @@ open class NewRunCommand(val info: RunCommandInfo) {
|
||||||
else listOf()
|
else listOf()
|
||||||
|
|
||||||
// Check to see if the command succeeded
|
// Check to see if the command succeeded
|
||||||
val isSuccess = isSuccess(returnCode, input, error)
|
val isSuccess =
|
||||||
|
if (info.containsErrors != null) ! info.containsErrors!!(error)
|
||||||
|
else isSuccess(returnCode, input, error)
|
||||||
|
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
info.successCallback(input)
|
info.successCallback(input)
|
||||||
|
|
|
@ -111,7 +111,7 @@ class KotlinCompiler @Inject constructor(
|
||||||
args = newArgs
|
args = newArgs
|
||||||
directory = File(".")
|
directory = File(".")
|
||||||
// The Kotlin compiler issues warnings on stderr :-(
|
// The Kotlin compiler issues warnings on stderr :-(
|
||||||
useErrorStreamAsErrorIndicator = false
|
containsErrors = { errors: List<String> -> errors.any { it.contains("rror")} }
|
||||||
}).invoke()
|
}).invoke()
|
||||||
return TaskResult(result == 0, "Error while compiling")
|
return TaskResult(result == 0, "Error while compiling")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue