Remove CompositeICReporterAsync
This commit is contained in:
committed by
Alexander Likhachev
parent
2c1e4c1769
commit
97a09680d5
+20
-52
@@ -8,22 +8,21 @@ package org.jetbrains.kotlin.daemon.report.experimental
|
|||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import org.jetbrains.kotlin.cli.common.ExitCode
|
import org.jetbrains.kotlin.cli.common.ExitCode
|
||||||
import org.jetbrains.kotlin.daemon.common.*
|
import org.jetbrains.kotlin.daemon.common.*
|
||||||
|
import org.jetbrains.kotlin.daemon.report.CompositeICReporter
|
||||||
import org.jetbrains.kotlin.daemon.report.RemoteICReporter
|
import org.jetbrains.kotlin.daemon.report.RemoteICReporter
|
||||||
import org.jetbrains.kotlin.incremental.ICReporter
|
|
||||||
import org.jetbrains.kotlin.incremental.ICReporterBase
|
import org.jetbrains.kotlin.incremental.ICReporterBase
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.Serializable
|
|
||||||
|
|
||||||
internal class DebugMessagesICReporterAsync(
|
internal class DebugMessagesICReporterAsync(
|
||||||
private val servicesFacade: CompilerServicesFacadeBaseAsync,
|
private val servicesFacade: CompilerServicesFacadeBaseAsync,
|
||||||
rootDir: File,
|
rootDir: File,
|
||||||
private val isVerbose: Boolean
|
private val isVerbose: Boolean
|
||||||
) : ICReporterBase(rootDir), RemoteICReporter {
|
) : ICReporterBase(rootDir), RemoteICReporter {
|
||||||
override fun report(message: () -> String) {
|
override fun report(message: () -> String) {
|
||||||
GlobalScope.async {
|
GlobalScope.async {
|
||||||
servicesFacade.report(
|
servicesFacade.report(
|
||||||
ReportCategory.IC_MESSAGE,
|
ReportCategory.IC_MESSAGE,
|
||||||
ReportSeverity.DEBUG, message()
|
ReportSeverity.DEBUG, message()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,13 +41,13 @@ internal class DebugMessagesICReporterAsync(
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal class CompileIterationICReporterAsync(
|
internal class CompileIterationICReporterAsync(
|
||||||
private val compilationResults: CompilationResultsAsync?
|
private val compilationResults: CompilationResultsAsync?
|
||||||
) : ICReporterBase(), RemoteICReporter {
|
) : ICReporterBase(), RemoteICReporter {
|
||||||
override fun reportCompileIteration(incremental: Boolean, sourceFiles: Collection<File>, exitCode: ExitCode) {
|
override fun reportCompileIteration(incremental: Boolean, sourceFiles: Collection<File>, exitCode: ExitCode) {
|
||||||
GlobalScope.async {
|
GlobalScope.async {
|
||||||
compilationResults?.add(
|
compilationResults?.add(
|
||||||
CompilationResultCategory.IC_COMPILE_ITERATION.code,
|
CompilationResultCategory.IC_COMPILE_ITERATION.code,
|
||||||
CompileIterationResult(sourceFiles, exitCode.toString())
|
CompileIterationResult(sourceFiles, exitCode.toString())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,9 +63,9 @@ internal class CompileIterationICReporterAsync(
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal class BuildReportICReporterAsync(
|
internal class BuildReportICReporterAsync(
|
||||||
private val compilationResults: CompilationResultsAsync?,
|
private val compilationResults: CompilationResultsAsync?,
|
||||||
rootDir: File,
|
rootDir: File,
|
||||||
private val isVerbose: Boolean = false
|
private val isVerbose: Boolean = false
|
||||||
) : ICReporterBase(rootDir), RemoteICReporter {
|
) : ICReporterBase(rootDir), RemoteICReporter {
|
||||||
private val icLogLines = arrayListOf<String>()
|
private val icLogLines = arrayListOf<String>()
|
||||||
private val recompilationReason = HashMap<File, 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(
|
fun getICReporterAsync(
|
||||||
servicesFacade: CompilerServicesFacadeBaseAsync,
|
servicesFacade: CompilerServicesFacadeBaseAsync,
|
||||||
compilationResults: CompilationResultsAsync?,
|
compilationResults: CompilationResultsAsync?,
|
||||||
compilationOptions: IncrementalCompilationOptions
|
compilationOptions: IncrementalCompilationOptions
|
||||||
): RemoteICReporter {
|
): RemoteICReporter {
|
||||||
val root = compilationOptions.modulesInfo.projectRoot
|
val root = compilationOptions.modulesInfo.projectRoot
|
||||||
val reporters = ArrayList<RemoteICReporter>()
|
val reporters = ArrayList<RemoteICReporter>()
|
||||||
@@ -148,10 +116,10 @@ fun getICReporterAsync(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val requestedResults = compilationOptions
|
val requestedResults = compilationOptions
|
||||||
.requestedCompilationResults
|
.requestedCompilationResults
|
||||||
.mapNotNullTo(HashSet()) { resultCode ->
|
.mapNotNullTo(HashSet()) { resultCode ->
|
||||||
CompilationResultCategory.values().getOrNull(resultCode)
|
CompilationResultCategory.values().getOrNull(resultCode)
|
||||||
}
|
}
|
||||||
requestedResults.mapTo(reporters) { requestedResult ->
|
requestedResults.mapTo(reporters) { requestedResult ->
|
||||||
when (requestedResult) {
|
when (requestedResult) {
|
||||||
CompilationResultCategory.IC_COMPILE_ITERATION -> {
|
CompilationResultCategory.IC_COMPILE_ITERATION -> {
|
||||||
@@ -166,5 +134,5 @@ fun getICReporterAsync(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CompositeICReporterAsync(reporters)
|
return CompositeICReporter(reporters)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user