diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsCompilerServicesFacadeImpl.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsCompilerServicesFacadeImpl.kt index b4df5aa4089..f3610bbfed9 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsCompilerServicesFacadeImpl.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsCompilerServicesFacadeImpl.kt @@ -39,12 +39,19 @@ internal class JpsCompilerServicesFacadeImpl( ReportCategory.OUTPUT_MESSAGE -> { env.messageCollector.report(CompilerMessageSeverity.OUTPUT, message!!, CompilerMessageLocation.NO_LOCATION) } + ReportCategory.EXCEPTION -> { + env.messageCollector.report(CompilerMessageSeverity.EXCEPTION, message!!, CompilerMessageLocation.NO_LOCATION) + } ReportCategory.COMPILER_MESSAGE -> { - val compilerMessageAttachment = attachment as? CompilerMessageAttachment - if (message != null && compilerMessageAttachment != null) { - val originalSeverity = compilerMessageAttachment.severity - val originalLocation = compilerMessageAttachment.location - env.messageCollector.report(originalSeverity, message, originalLocation) + val compilerSeverity = when (ReportSeverity.fromCode(severity)) { + ReportSeverity.ERROR -> CompilerMessageSeverity.ERROR + ReportSeverity.WARNING -> CompilerMessageSeverity.WARNING + ReportSeverity.INFO -> CompilerMessageSeverity.INFO + ReportSeverity.DEBUG -> CompilerMessageSeverity.LOGGING + else -> throw IllegalStateException("Unexpected compiler message report severity $severity") + } + if (message != null && attachment is CompilerMessageLocation) { + env.messageCollector.report(compilerSeverity, message, attachment) } else { reportUnexpected(category, severity, message, attachment) diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt index 75c670d28e4..e4f20cfb84d 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt @@ -110,14 +110,19 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner() { return res?.get()?.let { exitCodeFromProcessExitCode(it) } } - private fun reportCategories(verbose: Boolean): Array = + private fun reportCategories(verbose: Boolean): Array { + val categories = if (!verbose) { - arrayOf(ReportCategory.COMPILER_MESSAGE.code) + arrayOf(ReportCategory.COMPILER_MESSAGE, ReportCategory.EXCEPTION) } else { - ReportCategory.values().map { it.code }.toTypedArray() + ReportCategory.values() } + return categories.map { it.code }.toTypedArray() + } + + private fun reportSeverity(verbose: Boolean): Int = if (!verbose) { ReportSeverity.INFO.code