Log daemon exception for In process compilation into error.log
This commit is contained in:
committed by
Space Team
parent
242b83edbd
commit
2379185398
+2
-1
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.incremental
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.incremental.AbiSnapshotImpl.Companion.readAbiSnapshot
|
||||
import org.jetbrains.kotlin.incremental.AbiSnapshotImpl.Companion.writeAbiSnapshot
|
||||
import org.jetbrains.kotlin.incremental.util.ExceptionLocation
|
||||
import org.jetbrains.kotlin.incremental.util.reportException
|
||||
import java.io.*
|
||||
|
||||
@@ -51,7 +52,7 @@ data class BuildInfo(val startTS: Long, val dependencyToAbiSnapshot: Map<String,
|
||||
it.readBuildInfo()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
messageCollector.reportException(e)
|
||||
messageCollector.reportException(e, ExceptionLocation.INCREMENTAL_COMPILATION)
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -36,6 +36,7 @@ import org.jetbrains.kotlin.incremental.components.ExpectActualTracker
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.incremental.parsing.classesFqNames
|
||||
import org.jetbrains.kotlin.incremental.util.BufferingMessageCollector
|
||||
import org.jetbrains.kotlin.incremental.util.ExceptionLocation
|
||||
import org.jetbrains.kotlin.incremental.util.reportException
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.progress.CompilationCanceledStatus
|
||||
@@ -98,7 +99,7 @@ abstract class IncrementalCompilerRunner<
|
||||
)
|
||||
}
|
||||
is ICResult.Failed -> {
|
||||
messageCollector.reportException(result.cause)
|
||||
messageCollector.reportException(result.cause, ExceptionLocation.INCREMENTAL_COMPILATION)
|
||||
reporter.warn {
|
||||
// The indentation after the first line is intentional (so that this message is distinct from next message)
|
||||
"""
|
||||
|
||||
+8
-3
@@ -7,8 +7,13 @@ package org.jetbrains.kotlin.incremental.util
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
|
||||
|
||||
internal fun MessageCollector.reportException(e: Throwable) {
|
||||
report(severity = CompilerMessageSeverity.EXCEPTION, message = "Incremental compilation failed:${e.message}\n${e.stackTraceToString()}")
|
||||
public fun MessageCollector.reportException(e: Throwable, location: ExceptionLocation) {
|
||||
report(severity = CompilerMessageSeverity.EXCEPTION, message = "$location failed:${e.message}\n${e.stackTraceToString()}")
|
||||
}
|
||||
|
||||
public enum class ExceptionLocation(val readablename: String) {
|
||||
INCREMENTAL_COMPILATION("Incremental compilation"),
|
||||
DAEMON("Daemon compilation"),
|
||||
OUT_OF_PROCESS_COMPILATION("Out of process compilation")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user