Remove CompositeICReporterAsync

This commit is contained in:
Alexey Tsvetkov
2019-12-16 10:15:04 +03:00
committed by Alexander Likhachev
parent 2c1e4c1769
commit 97a09680d5
@@ -8,22 +8,21 @@ package org.jetbrains.kotlin.daemon.report.experimental
import kotlinx.coroutines.*
import org.jetbrains.kotlin.cli.common.ExitCode
import org.jetbrains.kotlin.daemon.common.*
import org.jetbrains.kotlin.daemon.report.CompositeICReporter
import org.jetbrains.kotlin.daemon.report.RemoteICReporter
import org.jetbrains.kotlin.incremental.ICReporter
import org.jetbrains.kotlin.incremental.ICReporterBase
import java.io.File
import java.io.Serializable
internal class DebugMessagesICReporterAsync(
private val servicesFacade: CompilerServicesFacadeBaseAsync,
rootDir: File,
private val isVerbose: Boolean
private val servicesFacade: CompilerServicesFacadeBaseAsync,
rootDir: File,
private val isVerbose: Boolean
) : ICReporterBase(rootDir), RemoteICReporter {
override fun report(message: () -> String) {
GlobalScope.async {
servicesFacade.report(
ReportCategory.IC_MESSAGE,
ReportSeverity.DEBUG, message()
ReportCategory.IC_MESSAGE,
ReportSeverity.DEBUG, message()
)
}
}
@@ -42,13 +41,13 @@ internal class DebugMessagesICReporterAsync(
}
internal class CompileIterationICReporterAsync(
private val compilationResults: CompilationResultsAsync?
private val compilationResults: CompilationResultsAsync?
) : ICReporterBase(), RemoteICReporter {
override fun reportCompileIteration(incremental: Boolean, sourceFiles: Collection<File>, exitCode: ExitCode) {
GlobalScope.async {
compilationResults?.add(
CompilationResultCategory.IC_COMPILE_ITERATION.code,
CompileIterationResult(sourceFiles, exitCode.toString())
CompilationResultCategory.IC_COMPILE_ITERATION.code,
CompileIterationResult(sourceFiles, exitCode.toString())
)
}
}
@@ -64,9 +63,9 @@ internal class CompileIterationICReporterAsync(
}
internal class BuildReportICReporterAsync(
private val compilationResults: CompilationResultsAsync?,
rootDir: File,
private val isVerbose: Boolean = false
private val compilationResults: CompilationResultsAsync?,
rootDir: File,
private val isVerbose: Boolean = false
) : ICReporterBase(rootDir), RemoteICReporter {
private val icLogLines = arrayListOf<String>()
private val recompilationReason = HashMap<File, String>()
@@ -103,41 +102,10 @@ internal class BuildReportICReporterAsync(
}
}
internal class CompositeICReporterAsync(private val reporters: Iterable<RemoteICReporter>) :
RemoteICReporter {
override fun report(message: () -> String) {
reporters.forEach { it.report(message) }
}
override fun reportVerbose(message: () -> String) {
reporters.forEach { it.reportVerbose(message) }
}
override fun reportCompileIteration(incremental: Boolean, sourceFiles: Collection<File>, exitCode: ExitCode) {
reporters.forEach { it.reportCompileIteration(incremental, sourceFiles, exitCode) }
}
override fun reportMarkDirtyClass(affectedFiles: Iterable<File>, classFqName: String) {
reporters.forEach { it.reportMarkDirtyClass(affectedFiles, classFqName) }
}
override fun reportMarkDirtyMember(affectedFiles: Iterable<File>, scope: String, name: String) {
reporters.forEach { it.reportMarkDirtyMember(affectedFiles, scope, name) }
}
override fun reportMarkDirty(affectedFiles: Iterable<File>, reason: String) {
reporters.forEach { it.reportMarkDirty(affectedFiles, reason) }
}
override fun flush() {
reporters.forEach { it.flush() }
}
}
fun getICReporterAsync(
servicesFacade: CompilerServicesFacadeBaseAsync,
compilationResults: CompilationResultsAsync?,
compilationOptions: IncrementalCompilationOptions
servicesFacade: CompilerServicesFacadeBaseAsync,
compilationResults: CompilationResultsAsync?,
compilationOptions: IncrementalCompilationOptions
): RemoteICReporter {
val root = compilationOptions.modulesInfo.projectRoot
val reporters = ArrayList<RemoteICReporter>()
@@ -148,10 +116,10 @@ fun getICReporterAsync(
}
val requestedResults = compilationOptions
.requestedCompilationResults
.mapNotNullTo(HashSet()) { resultCode ->
CompilationResultCategory.values().getOrNull(resultCode)
}
.requestedCompilationResults
.mapNotNullTo(HashSet()) { resultCode ->
CompilationResultCategory.values().getOrNull(resultCode)
}
requestedResults.mapTo(reporters) { requestedResult ->
when (requestedResult) {
CompilationResultCategory.IC_COMPILE_ITERATION -> {
@@ -166,5 +134,5 @@ fun getICReporterAsync(
}
}
return CompositeICReporterAsync(reporters)
return CompositeICReporter(reporters)
}