From 97a09680d56c816ecd35622f42e95904ff399a80 Mon Sep 17 00:00:00 2001 From: Alexey Tsvetkov Date: Mon, 16 Dec 2019 10:15:04 +0300 Subject: [PATCH] Remove CompositeICReporterAsync --- .../report/experimental/RemoteICReporter.kt | 72 ++++++------------- 1 file changed, 20 insertions(+), 52 deletions(-) diff --git a/compiler/daemon/src/org/jetbrains/kotlin/daemon/report/experimental/RemoteICReporter.kt b/compiler/daemon/src/org/jetbrains/kotlin/daemon/report/experimental/RemoteICReporter.kt index 7dd3220a1a8..e32d74e9946 100644 --- a/compiler/daemon/src/org/jetbrains/kotlin/daemon/report/experimental/RemoteICReporter.kt +++ b/compiler/daemon/src/org/jetbrains/kotlin/daemon/report/experimental/RemoteICReporter.kt @@ -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, 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() private val recompilationReason = HashMap() @@ -103,41 +102,10 @@ internal class BuildReportICReporterAsync( } } -internal class CompositeICReporterAsync(private val reporters: Iterable) : - 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, exitCode: ExitCode) { - reporters.forEach { it.reportCompileIteration(incremental, sourceFiles, exitCode) } - } - - override fun reportMarkDirtyClass(affectedFiles: Iterable, classFqName: String) { - reporters.forEach { it.reportMarkDirtyClass(affectedFiles, classFqName) } - } - - override fun reportMarkDirtyMember(affectedFiles: Iterable, scope: String, name: String) { - reporters.forEach { it.reportMarkDirtyMember(affectedFiles, scope, name) } - } - - override fun reportMarkDirty(affectedFiles: Iterable, 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() @@ -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) } \ No newline at end of file