[KLIB Resolver] Report KLIB resolver issues as compiler messages
The reason of this change is to make messages (especially warnings) that are reported by the KLIB resolver become visible to the end user. This can be achieved to forwarding such messages to the appropriate compiler's components such as `org.jetbrains.kotlin.cli.common.messages.MessageCollector` and `org.jetbrains.kotlin.ir.util.IrMessageLogger`. Also: The default `DummyLogger` should be used as minimal as possible. Because it just forwards messages to the standard output (console) where they can remain unattended. When the compiler is executed from the Gradle plugin such messages appear only in DEBUG Gradle's log. ^KT-63573
This commit is contained in:
committed by
Space Team
parent
8430be39c9
commit
46081f968d
@@ -13,6 +13,18 @@ interface WithLogger {
|
||||
val logger: Logger
|
||||
}
|
||||
|
||||
/**
|
||||
* The default logger that just prints messages to console.
|
||||
*
|
||||
* Caution: Whenever possible please try to use more appropriate alternatives to [DummyLogger] that
|
||||
* would direct the output to the proper logs. Here are some of them:
|
||||
* - [org.jetbrains.kotlin.gradle.utils.GradleLoggerAdapter] - to be used in Gradle plugins.
|
||||
* - [org.jetbrains.kotlin.cli.common.messages.CompilerLoggerAdapter] - to be used in all flavors of the Kotlin compiler. Can be accessed
|
||||
* via [org.jetbrains.kotlin.cli.common.messages.toLogger] and [org.jetbrains.kotlin.cli.common.messages.getLogger].
|
||||
* - [org.jetbrains.kotlin.backend.common.IrMessageLoggerAdapter] - to be used in those parts of the compiler where
|
||||
* [org.jetbrains.kotlin.cli.common.messages.CompilerLoggerAdapter] is not available. Can be accessed via
|
||||
* [org.jetbrains.kotlin.backend.common.toLogger].
|
||||
*/
|
||||
object DummyLogger : Logger {
|
||||
override fun log(message: String) = println(message)
|
||||
override fun error(message: String) = println("e: $message")
|
||||
|
||||
Reference in New Issue
Block a user