KT-45777: Replace EmptyICReporter with DoNothingICReporter

to be more consistent (every *Reporter has a DoNothing*Reporter).

^KT-45777 In Progress
This commit is contained in:
Hung Nguyen
2022-03-24 11:02:07 +00:00
committed by teamcity
parent d70dbf3146
commit f23e66a6e2
4 changed files with 9 additions and 18 deletions
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.build.GeneratedFile
import org.jetbrains.kotlin.build.report.BuildReporter
import org.jetbrains.kotlin.build.report.DoNothingICReporter
import org.jetbrains.kotlin.build.report.ICReporter
import org.jetbrains.kotlin.build.report.metrics.BuildAttribute
import org.jetbrains.kotlin.build.report.metrics.DoNothingBuildMetricsReporter
@@ -44,7 +45,7 @@ fun makeJsIncrementally(
args: K2JSCompilerArguments,
buildHistoryFile: File,
messageCollector: MessageCollector = MessageCollector.NONE,
reporter: ICReporter = EmptyICReporter,
reporter: ICReporter = DoNothingICReporter,
scopeExpansion: CompileScopeExpansionMode = CompileScopeExpansionMode.NEVER,
modulesApiHistory: ModulesApiHistory = EmptyModulesApiHistory,
providedChangedFiles: ChangedFiles? = null
@@ -27,8 +27,8 @@ import org.jetbrains.kotlin.build.DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS
import org.jetbrains.kotlin.build.GeneratedFile
import org.jetbrains.kotlin.build.GeneratedJvmClass
import org.jetbrains.kotlin.build.report.BuildReporter
import org.jetbrains.kotlin.build.report.DoNothingICReporter
import org.jetbrains.kotlin.build.report.ICReporter
import org.jetbrains.kotlin.build.report.ICReporterBase
import org.jetbrains.kotlin.build.report.metrics.BuildAttribute
import org.jetbrains.kotlin.build.report.metrics.BuildTime
import org.jetbrains.kotlin.build.report.metrics.DoNothingBuildMetricsReporter
@@ -77,7 +77,7 @@ fun makeIncrementally(
sourceRoots: Iterable<File>,
args: K2JVMCompilerArguments,
messageCollector: MessageCollector = MessageCollector.NONE,
reporter: ICReporter = EmptyICReporter
reporter: ICReporter = DoNothingICReporter
) {
val kotlinExtensions = DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS
val allExtensions = kotlinExtensions + "java"
@@ -104,15 +104,6 @@ fun makeIncrementally(
}
}
object EmptyICReporter : ICReporterBase() {
override fun report(message: () -> String) {}
override fun reportVerbose(message: () -> String) {}
override fun reportCompileIteration(incremental: Boolean, sourceFiles: Collection<File>, exitCode: ExitCode) {}
override fun reportMarkDirtyClass(affectedFiles: Iterable<File>, classFqName: String) {}
override fun reportMarkDirtyMember(affectedFiles: Iterable<File>, scope: String, name: String) {}
override fun reportMarkDirty(affectedFiles: Iterable<File>, reason: String) {}
}
@Suppress("DEPRECATION")
inline fun <R> withIC(args: CommonCompilerArguments, enabled: Boolean = true, fn: () -> R): R {
val isEnabledBackup = IncrementalCompilation.isEnabledForJvm()
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.incremental.classpathDiff
import com.intellij.openapi.util.io.FileUtil
import org.jetbrains.kotlin.build.report.DoNothingICReporter
import org.jetbrains.kotlin.build.report.metrics.BuildMetricsReporter
import org.jetbrains.kotlin.build.report.metrics.BuildTime
import org.jetbrains.kotlin.build.report.metrics.measure
@@ -238,7 +239,7 @@ object ClasspathChangesComputer {
incrementalJvmCache.clearCacheForRemovedClasses(changesCollector)
// Normalize the changes and clean up
val dirtyData = changesCollector.getDirtyData(listOf(incrementalJvmCache), EmptyICReporter)
val dirtyData = changesCollector.getDirtyData(listOf(incrementalJvmCache), DoNothingICReporter)
workingDir.deleteRecursively()
return dirtyData.toProgramSymbols(currentClassSnapshots, previousClassSnapshots)
@@ -18,8 +18,7 @@ import org.jetbrains.kotlin.backend.common.serialization.CompatibilityMode
import org.jetbrains.kotlin.backend.common.serialization.KlibIrVersion
import org.jetbrains.kotlin.backend.common.serialization.metadata.KlibMetadataVersion
import org.jetbrains.kotlin.backend.common.serialization.signature.IdSignatureDescriptor
import org.jetbrains.kotlin.build.report.BuildReporter
import org.jetbrains.kotlin.build.report.metrics.DoNothingBuildMetricsReporter
import org.jetbrains.kotlin.build.report.DoNothingBuildReporter
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
@@ -28,7 +27,6 @@ import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
import org.jetbrains.kotlin.descriptors.konan.kotlinLibrary
import org.jetbrains.kotlin.incremental.ChangedFiles
import org.jetbrains.kotlin.incremental.EmptyICReporter
import org.jetbrains.kotlin.incremental.IncrementalJsCompilerRunner
import org.jetbrains.kotlin.incremental.multiproject.EmptyModulesApiHistory
import org.jetbrains.kotlin.incremental.withJsIC
@@ -322,7 +320,7 @@ class GenerateIrRuntime {
withJsIC(args) {
val buildHistoryFile = File(cachesDir, "build-history.bin")
val compiler = IncrementalJsCompilerRunner(
cachesDir, BuildReporter(EmptyICReporter, DoNothingBuildMetricsReporter),
cachesDir, DoNothingBuildReporter,
buildHistoryFile = buildHistoryFile,
modulesApiHistory = EmptyModulesApiHistory
)
@@ -366,7 +364,7 @@ class GenerateIrRuntime {
withJsIC(args) {
val buildHistoryFile = File(cachesDir, "build-history.bin")
val compiler = IncrementalJsCompilerRunner(
cachesDir, BuildReporter(EmptyICReporter, DoNothingBuildMetricsReporter),
cachesDir, DoNothingBuildReporter,
buildHistoryFile = buildHistoryFile,
modulesApiHistory = EmptyModulesApiHistory
)