Minor: introduce EXCEPTION report category

Original commit: 072edf4b5a
This commit is contained in:
Alexey Tsvetkov
2017-01-13 08:24:23 +03:00
parent 9594031126
commit cf3a2bf787
2 changed files with 20 additions and 8 deletions
@@ -39,12 +39,19 @@ internal class JpsCompilerServicesFacadeImpl(
ReportCategory.OUTPUT_MESSAGE -> { ReportCategory.OUTPUT_MESSAGE -> {
env.messageCollector.report(CompilerMessageSeverity.OUTPUT, message!!, CompilerMessageLocation.NO_LOCATION) env.messageCollector.report(CompilerMessageSeverity.OUTPUT, message!!, CompilerMessageLocation.NO_LOCATION)
} }
ReportCategory.EXCEPTION -> {
env.messageCollector.report(CompilerMessageSeverity.EXCEPTION, message!!, CompilerMessageLocation.NO_LOCATION)
}
ReportCategory.COMPILER_MESSAGE -> { ReportCategory.COMPILER_MESSAGE -> {
val compilerMessageAttachment = attachment as? CompilerMessageAttachment val compilerSeverity = when (ReportSeverity.fromCode(severity)) {
if (message != null && compilerMessageAttachment != null) { ReportSeverity.ERROR -> CompilerMessageSeverity.ERROR
val originalSeverity = compilerMessageAttachment.severity ReportSeverity.WARNING -> CompilerMessageSeverity.WARNING
val originalLocation = compilerMessageAttachment.location ReportSeverity.INFO -> CompilerMessageSeverity.INFO
env.messageCollector.report(originalSeverity, message, originalLocation) 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 { else {
reportUnexpected(category, severity, message, attachment) reportUnexpected(category, severity, message, attachment)
@@ -110,14 +110,19 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner<JpsCompilerEnvironment>() {
return res?.get()?.let { exitCodeFromProcessExitCode(it) } return res?.get()?.let { exitCodeFromProcessExitCode(it) }
} }
private fun reportCategories(verbose: Boolean): Array<Int> = private fun reportCategories(verbose: Boolean): Array<Int> {
val categories =
if (!verbose) { if (!verbose) {
arrayOf(ReportCategory.COMPILER_MESSAGE.code) arrayOf(ReportCategory.COMPILER_MESSAGE, ReportCategory.EXCEPTION)
} }
else { else {
ReportCategory.values().map { it.code }.toTypedArray() ReportCategory.values()
} }
return categories.map { it.code }.toTypedArray()
}
private fun reportSeverity(verbose: Boolean): Int = private fun reportSeverity(verbose: Boolean): Int =
if (!verbose) { if (!verbose) {
ReportSeverity.INFO.code ReportSeverity.INFO.code