Improve daemon client debug reports
Before this change a daemon client debug messages were printed only when the client could not connect and the 'kotlin.daemon.verbose' system property was set up. Now messages are printed if the debug logging is enabled and the 'kotlin.daemon.verbose' is set up.
This commit is contained in:
+7
-1
@@ -42,6 +42,8 @@ interface KotlinLogger {
|
||||
fun warn(msg: String)
|
||||
fun info(msg: String)
|
||||
fun debug(msg: String)
|
||||
|
||||
val isDebugEnabled: Boolean
|
||||
}
|
||||
|
||||
abstract class KotlinCompilerRunner<in Env : CompilerEnvironment> {
|
||||
@@ -61,11 +63,15 @@ abstract class KotlinCompilerRunner<in Env : CompilerEnvironment> {
|
||||
val daemonJVMOptions = configureDaemonJVMOptions(inheritMemoryLimits = true, inheritAdditionalProperties = true)
|
||||
|
||||
val daemonReportMessages = ArrayList<DaemonReportMessage>()
|
||||
val daemonReportingTargets = when {
|
||||
log.isDebugEnabled -> DaemonReportingTargets(messages = daemonReportMessages)
|
||||
else -> DaemonReportingTargets(messageCollector = environment.messageCollector)
|
||||
}
|
||||
|
||||
val profiler = if (daemonOptions.reportPerf) WallAndThreadAndMemoryTotalProfiler(withGC = false) else DummyProfiler()
|
||||
|
||||
val connection = profiler.withMeasure(null) {
|
||||
val daemon = KotlinCompilerClient.connectToCompileService(compilerId, daemonJVMOptions, daemonOptions, DaemonReportingTargets(null, daemonReportMessages), true, true)
|
||||
val daemon = KotlinCompilerClient.connectToCompileService(compilerId, daemonJVMOptions, daemonOptions, daemonReportingTargets, true, true)
|
||||
DaemonConnection(daemon, daemon?.leaseCompileSession(flagFile.absolutePath)?.get() ?: CompileService.NO_SESSION)
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -395,11 +395,13 @@ object KotlinCompilerClient {
|
||||
daemon.inputStream
|
||||
.reader()
|
||||
.forEachLine {
|
||||
reportingTargets.report(DaemonReportCategory.DEBUG, it, "daemon")
|
||||
|
||||
if (it == COMPILE_DAEMON_IS_READY_MESSAGE) {
|
||||
reportingTargets.report(DaemonReportCategory.DEBUG, "Received the message signalling that the daemon is ready")
|
||||
isEchoRead.release()
|
||||
return@forEachLine
|
||||
}
|
||||
reportingTargets.report(DaemonReportCategory.DEBUG, it, "daemon")
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
||||
@@ -34,4 +34,7 @@ internal class JpsKotlinLogger(private val log: Logger) : KotlinLogger {
|
||||
override fun debug(msg: String) {
|
||||
log.debug(msg)
|
||||
}
|
||||
|
||||
override val isDebugEnabled: Boolean
|
||||
get() = log.isDebugEnabled
|
||||
}
|
||||
+3
@@ -34,4 +34,7 @@ internal class GradleKotlinLogger(private val log: Logger) : KotlinLogger {
|
||||
override fun warn(msg: String) {
|
||||
log.warn(msg)
|
||||
}
|
||||
|
||||
override val isDebugEnabled: Boolean
|
||||
get() = log.isDebugEnabled
|
||||
}
|
||||
Reference in New Issue
Block a user