From 5b6afef67d7f39bd1de8635c45e924f73fd90142 Mon Sep 17 00:00:00 2001 From: Hung Nguyen Date: Fri, 24 Jun 2022 14:33:39 +0100 Subject: [PATCH] Rename ICReporter.report/reportVerbose to info/debug to make it clear what severity levels they are mapped to. ^KT-52839 Fixed --- .../jetbrains/kotlin/build/report/ICReporter.kt | 9 ++++----- .../kotlin/build/report/ICReporterBase.kt | 2 +- .../jetbrains/kotlin/incremental/buildUtil.kt | 3 ++- .../kotlin/daemon/CompileServiceImpl.kt | 5 ++--- .../jetbrains/kotlin/incremental/AbiSnapshot.kt | 3 ++- .../kotlin/incremental/BuildDiffsStorage.kt | 5 +++-- .../incremental/ChangedJavaFilesProcessor.kt | 5 +++-- .../incremental/IncrementalCachesManager.kt | 5 +++-- .../incremental/IncrementalCompilerRunner.kt | 17 ++++++++++------- .../incremental/IncrementalJsCompilerRunner.kt | 3 ++- .../incremental/IncrementalJvmCompilerRunner.kt | 16 +++++++--------- .../jetbrains/kotlin/incremental/InputsCache.kt | 3 ++- .../kotlin/incremental/changesDetectionUtils.kt | 13 +++++++------ .../classpathDiff/ClasspathChangesComputer.kt | 5 +++-- .../ClasspathSnapshotBuildReporter.kt | 3 ++- .../classpathDiff/ClasspathSnapshotShrinker.kt | 3 ++- .../jetbrains/kotlin/jps/build/KotlinBuilder.kt | 5 +++-- 17 files changed, 58 insertions(+), 47 deletions(-) diff --git a/build-common/src/org/jetbrains/kotlin/build/report/ICReporter.kt b/build-common/src/org/jetbrains/kotlin/build/report/ICReporter.kt index db7c869984e..0d2a51dce84 100644 --- a/build-common/src/org/jetbrains/kotlin/build/report/ICReporter.kt +++ b/build-common/src/org/jetbrains/kotlin/build/report/ICReporter.kt @@ -18,17 +18,16 @@ interface ICReporter { fun report(message: () -> String, severity: ReportSeverity) - // TODO: Move these 3 functions outside of this interface and make them extension functions so they can't be overridden - fun warn(message: () -> String) = report(message, severity = ReportSeverity.WARNING) - fun report(message: () -> String) = report(message, severity = ReportSeverity.INFO) - fun reportVerbose(message: () -> String) = report(message, severity = ReportSeverity.DEBUG) - fun reportCompileIteration(incremental: Boolean, sourceFiles: Collection, exitCode: ExitCode) fun reportMarkDirtyClass(affectedFiles: Iterable, classFqName: String) fun reportMarkDirtyMember(affectedFiles: Iterable, scope: String, name: String) fun reportMarkDirty(affectedFiles: Iterable, reason: String) } +fun ICReporter.warn(message: () -> String) = report(message, severity = ICReporter.ReportSeverity.WARNING) +fun ICReporter.info(message: () -> String) = report(message, severity = ICReporter.ReportSeverity.INFO) +fun ICReporter.debug(message: () -> String) = report(message, severity = ICReporter.ReportSeverity.DEBUG) + object DoNothingICReporter : ICReporter { override fun report(message: () -> String, severity: ICReporter.ReportSeverity) {} override fun reportCompileIteration(incremental: Boolean, sourceFiles: Collection, exitCode: ExitCode) {} diff --git a/build-common/src/org/jetbrains/kotlin/build/report/ICReporterBase.kt b/build-common/src/org/jetbrains/kotlin/build/report/ICReporterBase.kt index db03207f8b2..8e31210e23d 100644 --- a/build-common/src/org/jetbrains/kotlin/build/report/ICReporterBase.kt +++ b/build-common/src/org/jetbrains/kotlin/build/report/ICReporterBase.kt @@ -18,7 +18,7 @@ abstract class ICReporterBase(private val pathsBase: File? = null) : ICReporter override fun reportMarkDirty(affectedFiles: Iterable, reason: String) { affectedFiles.forEach { file -> - reportVerbose { "${pathsAsString(file)} is marked dirty: $reason" } + debug { "${pathsAsString(file)} is marked dirty: $reason" } } } diff --git a/build-common/src/org/jetbrains/kotlin/incremental/buildUtil.kt b/build-common/src/org/jetbrains/kotlin/incremental/buildUtil.kt index 90b1f5c0e7d..312e8e7feb2 100644 --- a/build-common/src/org/jetbrains/kotlin/incremental/buildUtil.kt +++ b/build-common/src/org/jetbrains/kotlin/incremental/buildUtil.kt @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.build.GeneratedJvmClass import org.jetbrains.kotlin.build.JvmSourceRoot import org.jetbrains.kotlin.build.isModuleMappingFile import org.jetbrains.kotlin.build.report.ICReporter +import org.jetbrains.kotlin.build.report.debug import org.jetbrains.kotlin.config.Services import org.jetbrains.kotlin.incremental.components.LookupTracker import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache @@ -152,7 +153,7 @@ fun ChangesCollector.getDirtyData( val sealedParents = HashSet() for (change in changes()) { - reporter.reportVerbose { "Process $change" } + reporter.debug { "Process $change" } if (change is ChangeInfo.SignatureChanged) { val fqNames = if (!change.areSubclassesAffected) listOf(change.fqName) else withSubtypes(change.fqName, caches) diff --git a/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt b/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt index 223261d78a6..0970df74888 100644 --- a/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt +++ b/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt @@ -22,6 +22,7 @@ import com.intellij.openapi.vfs.impl.ZipHandler import com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem import org.jetbrains.kotlin.build.DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS import org.jetbrains.kotlin.build.report.RemoteBuildReporter +import org.jetbrains.kotlin.build.report.info import org.jetbrains.kotlin.cli.common.CLICompiler import org.jetbrains.kotlin.cli.common.CompilerSystemProperties import org.jetbrains.kotlin.cli.common.ExitCode @@ -35,8 +36,6 @@ import org.jetbrains.kotlin.cli.common.repl.ReplEvalResult import org.jetbrains.kotlin.cli.js.K2JSCompiler import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment -import org.jetbrains.kotlin.cli.jvm.compiler.jarfs.FastJarFileSystem -import org.jetbrains.kotlin.cli.jvm.compiler.jarfs.FastJarHandler import org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler import org.jetbrains.kotlin.config.KotlinCompilerVersion import org.jetbrains.kotlin.config.Services @@ -600,7 +599,7 @@ abstract class CompileServiceImplBase( val workingDir = incrementalCompilationOptions.workingDir val modulesApiHistory = incrementalCompilationOptions.run { - reporter.report { "Use module detection: ${multiModuleICSettings.useModuleDetection}" } + reporter.info { "Use module detection: ${multiModuleICSettings.useModuleDetection}" } if (!multiModuleICSettings.useModuleDetection) { ModulesApiHistoryJvm(modulesInfo) diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/AbiSnapshot.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/AbiSnapshot.kt index ea6d2919e75..027fcb06171 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/AbiSnapshot.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/AbiSnapshot.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.incremental import org.jetbrains.kotlin.build.report.BuildReporter +import org.jetbrains.kotlin.build.report.info import org.jetbrains.kotlin.metadata.deserialization.NameResolverImpl import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmNameResolver import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil @@ -153,7 +154,7 @@ class AbiSnapshotImpl(override val protos: MutableMap) : AbiS fun read(file: File, reporter: BuildReporter): AbiSnapshot? { if (!file.exists()) { - reporter.report { "jar snapshot $file is found for jar" } + reporter.info { "jar snapshot $file is found for jar" } return null } diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/BuildDiffsStorage.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/BuildDiffsStorage.kt index 1bba7480770..f711c9d9c9a 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/BuildDiffsStorage.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/BuildDiffsStorage.kt @@ -18,6 +18,7 @@ package org.jetbrains.kotlin.incremental import org.jetbrains.annotations.TestOnly import org.jetbrains.kotlin.build.report.ICReporter +import org.jetbrains.kotlin.build.report.info import org.jetbrains.kotlin.name.FqName import java.io.File import java.io.IOException @@ -36,7 +37,7 @@ data class BuildDiffsStorage(val buildDiffs: List) { fun readDiffsFromFile(file: File, reporter: ICReporter?): MutableList? { fun reportFail(reason: String) { - reporter?.report { "Could not read diff from file $file: $reason" } + reporter?.info { "Could not read diff from file $file: $reason" } } if (!file.exists()) return null @@ -77,7 +78,7 @@ data class BuildDiffsStorage(val buildDiffs: List) { } } } catch (e: IOException) { - reporter?.report { "Could not write diff to file $file: $e" } + reporter?.info { "Could not write diff to file $file: $e" } } } diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/ChangedJavaFilesProcessor.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/ChangedJavaFilesProcessor.kt index 307ecffee2f..0a69cc5c2e1 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/ChangedJavaFilesProcessor.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/ChangedJavaFilesProcessor.kt @@ -20,6 +20,7 @@ import com.intellij.psi.PsiClass import com.intellij.psi.PsiFile import com.intellij.psi.PsiJavaFile import org.jetbrains.kotlin.build.report.ICReporter +import org.jetbrains.kotlin.build.report.info import org.jetbrains.kotlin.build.report.metrics.BuildAttribute import java.io.File import java.util.* @@ -38,7 +39,7 @@ internal class ChangedJavaFilesProcessor( val removedJava = filesDiff.removed.filter(File::isJavaFile) if (removedJava.any()) { - reporter.report { "Some java files are removed: [${removedJava.joinToString()}]" } + reporter.info { "Some java files are removed: [${removedJava.joinToString()}]" } return ChangesEither.Unknown(BuildAttribute.JAVA_CHANGE_UNTRACKED_FILE_IS_REMOVED) } @@ -48,7 +49,7 @@ internal class ChangedJavaFilesProcessor( val psiFile = psiFileFactory(javaFile) if (psiFile !is PsiJavaFile) { - reporter.report { "Expected PsiJavaFile, got ${psiFile?.javaClass}" } + reporter.info { "Expected PsiJavaFile, got ${psiFile?.javaClass}" } return ChangesEither.Unknown(BuildAttribute.JAVA_CHANGE_UNEXPECTED_PSI) } diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalCachesManager.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalCachesManager.kt index a6acd7dd3b5..caaff24b041 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalCachesManager.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalCachesManager.kt @@ -17,6 +17,7 @@ package org.jetbrains.kotlin.incremental import org.jetbrains.kotlin.build.report.ICReporter +import org.jetbrains.kotlin.build.report.info import org.jetbrains.kotlin.incremental.storage.BasicMapsOwner import org.jetbrains.kotlin.incremental.storage.IncrementalFileToPathConverter import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol @@ -62,7 +63,7 @@ abstract class IncrementalCachesManager ): ExitCode { - reporter.report { "Non-incremental compilation will be performed: $reason" } + reporter.info { "Non-incremental compilation will be performed: $reason" } reporter.measure(BuildTime.CLEAR_OUTPUT_ON_REBUILD) { cleanOutputsAndLocalStateOnRebuild(args) } @@ -133,7 +136,7 @@ abstract class IncrementalCompilerRunner< val classpathAbiSnapshot = if (withAbiSnapshot) { - reporter.report { "Incremental compilation with ABI snapshot enabled" } + reporter.info { "Incremental compilation with ABI snapshot enabled" } reporter.measure(BuildTime.SET_UP_ABI_SNAPSHOTS) { setupJarDependencies(args, withAbiSnapshot, reporter) } @@ -196,7 +199,7 @@ abstract class IncrementalCompilerRunner< } } finally { if (!caches.close(flush = true)) { - reporter.report { "Unable to close IC caches. Cleaning internal state" } + reporter.info { "Unable to close IC caches. Cleaning internal state" } cleanOutputsAndLocalStateOnRebuild(args) } } @@ -212,15 +215,15 @@ abstract class IncrementalCompilerRunner< // Use Set as additionalOutputFiles may already contain destinationDir and workingDir val outputFiles = setOf(destinationDir(args), workingDir) + additionalOutputFiles - reporter.reportVerbose { "Cleaning outputs on rebuild" } + reporter.debug { "Cleaning outputs on rebuild" } outputFiles.forEach { when { it.isDirectory -> { - reporter.reportVerbose { " Deleting contents of directory '${it.path}'" } + reporter.debug { " Deleting contents of directory '${it.path}'" } it.cleanDirectoryContents() } it.isFile -> { - reporter.reportVerbose { " Deleting file '${it.path}'" } + reporter.debug { " Deleting file '${it.path}'" } it.deleteRecursivelyOrThrow() } } @@ -322,7 +325,7 @@ abstract class IncrementalCompilerRunner< classpathAbiSnapshot: Map = HashMap() ): ExitCode { if (compilationMode is CompilationMode.Rebuild) { - reporter.report { "Non-incremental compilation will be performed: ${compilationMode.reason}" } + reporter.info { "Non-incremental compilation will be performed: ${compilationMode.reason}" } } preBuildHook(args, compilationMode) diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJsCompilerRunner.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJsCompilerRunner.kt index e8389b4c6e6..70482779085 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJsCompilerRunner.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJsCompilerRunner.kt @@ -20,6 +20,7 @@ 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.info import org.jetbrains.kotlin.build.report.metrics.BuildAttribute import org.jetbrains.kotlin.build.report.metrics.DoNothingBuildMetricsReporter import org.jetbrains.kotlin.cli.common.ExitCode @@ -139,7 +140,7 @@ class IncrementalJsCompilerRunner( when (classpathChanges) { is ChangesEither.Unknown -> { - reporter.report { "Could not get classpath's changes: ${classpathChanges.reason}" } + reporter.info { "Could not get classpath's changes: ${classpathChanges.reason}" } return CompilationMode.Rebuild(classpathChanges.reason) } is ChangesEither.Known -> { diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt index 204e8eaf230..44db152438f 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt @@ -26,9 +26,7 @@ import org.jetbrains.annotations.TestOnly 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.* import org.jetbrains.kotlin.build.report.metrics.* import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys import org.jetbrains.kotlin.cli.common.ExitCode @@ -236,7 +234,7 @@ open class IncrementalJvmCompilerRunner( val dirtyFiles = DirtyFilesContainer(caches, reporter, kotlinSourceFilesExtensions) initDirtyFiles(dirtyFiles, changedFiles) - reporter.reportVerbose { "Classpath changes info passed from Gradle task: ${classpathChanges::class.simpleName}" } + reporter.debug { "Classpath changes info passed from Gradle task: ${classpathChanges::class.simpleName}" } val classpathChanges = when (classpathChanges) { // Note: classpathChanges is deserialized, so they are no longer singleton objects and need to be compared using `is` (not `==`) is NoChanges -> ChangesEither.Known(emptySet(), emptySet()) @@ -266,7 +264,7 @@ open class IncrementalJvmCompilerRunner( return CompilationMode.Rebuild(BuildAttribute.NO_BUILD_HISTORY) } val lastBuildInfo = BuildInfo.read(lastBuildInfoFile) - reporter.reportVerbose { "Last Kotlin Build info -- $lastBuildInfo" } + reporter.debug { "Last Kotlin Build info -- $lastBuildInfo" } val scopes = caches.lookupCache.lookupSymbols.map { it.scope.ifBlank { it.name } }.distinct() getClasspathChanges( @@ -280,7 +278,7 @@ open class IncrementalJvmCompilerRunner( @Suppress("UNUSED_VARIABLE") // for sealed when val unused = when (classpathChanges) { is ChangesEither.Unknown -> { - reporter.report { + reporter.info { "Could not get classpath's changes: ${classpathChanges.reason}" } return CompilationMode.Rebuild(classpathChanges.reason) @@ -327,20 +325,20 @@ open class IncrementalJvmCompilerRunner( if (!caches.platformCache.isTrackedFile(javaFile)) { if (!javaFile.exists()) { // todo: can we do this more optimal? - reporter.report { "Could not get changed for untracked removed java file $javaFile" } + reporter.info { "Could not get changed for untracked removed java file $javaFile" } return BuildAttribute.JAVA_CHANGE_UNTRACKED_FILE_IS_REMOVED } val psiFile = psiFileProvider.javaFile(javaFile) if (psiFile !is PsiJavaFile) { - reporter.report { "[Precise Java tracking] Expected PsiJavaFile, got ${psiFile?.javaClass}" } + reporter.info { "[Precise Java tracking] Expected PsiJavaFile, got ${psiFile?.javaClass}" } return BuildAttribute.JAVA_CHANGE_UNEXPECTED_PSI } for (psiClass in psiFile.classes) { val qualifiedName = psiClass.qualifiedName if (qualifiedName == null) { - reporter.report { "[Precise Java tracking] Class with unknown qualified name in $javaFile" } + reporter.info { "[Precise Java tracking] Class with unknown qualified name in $javaFile" } return BuildAttribute.JAVA_CHANGE_UNKNOWN_QUALIFIER } diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/InputsCache.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/InputsCache.kt index 68f1900e755..1a424e18284 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/InputsCache.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/InputsCache.kt @@ -19,6 +19,7 @@ package org.jetbrains.kotlin.incremental import com.intellij.util.containers.MultiMap import org.jetbrains.kotlin.build.GeneratedFile import org.jetbrains.kotlin.build.report.ICReporter +import org.jetbrains.kotlin.build.report.debug import org.jetbrains.kotlin.incremental.snapshots.FileSnapshotMap import org.jetbrains.kotlin.incremental.storage.BasicMapsOwner import org.jetbrains.kotlin.incremental.storage.FileToPathConverter @@ -41,7 +42,7 @@ class InputsCache( fun removeOutputForSourceFiles(sources: Iterable) { for (sourceFile in sources) { sourceToOutputMap.remove(sourceFile).forEach { - reporter.reportVerbose { "Deleting $it on clearing cache for $sourceFile" } + reporter.debug { "Deleting $it on clearing cache for $sourceFile" } it.delete() } } diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/changesDetectionUtils.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/changesDetectionUtils.kt index b3a5b9b50a3..a5cc07201d0 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/changesDetectionUtils.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/changesDetectionUtils.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.incremental import org.jetbrains.kotlin.build.report.BuildReporter +import org.jetbrains.kotlin.build.report.info import org.jetbrains.kotlin.build.report.metrics.BuildTime import org.jetbrains.kotlin.build.report.metrics.BuildAttribute import org.jetbrains.kotlin.build.report.metrics.measure @@ -38,7 +39,7 @@ internal fun getClasspathChanges( // todo: removed classes could be processed normally if (removedClasspath.isNotEmpty()) { - reporter.report { "Some files are removed from classpath: $removedClasspath" } + reporter.info { "Some files are removed from classpath: $removedClasspath" } return ChangesEither.Unknown(BuildAttribute.DEP_CHANGE_REMOVED_ENTRY) } @@ -53,7 +54,7 @@ internal fun getClasspathChanges( val actualAbiSnapshot = lastBuildInfo.dependencyToAbiSnapshot[module] if (actualAbiSnapshot == null) { - reporter.report { "Some jar are removed from classpath $module" } + reporter.info { "Some jar are removed from classpath $module" } return ChangesEither.Unknown(BuildAttribute.DEP_CHANGE_REMOVED_ENTRY) } val diffData = AbiSnapshotDiffService.doCompute(abiSnapshot, actualAbiSnapshot, caches, scopes) @@ -80,7 +81,7 @@ internal fun getClasspathChanges( val historyFiles = when (historyFilesEither) { is Either.Success> -> historyFilesEither.value is Either.Error -> { - reporter.report { "Could not find history files: ${historyFilesEither.reason}" } + reporter.info { "Could not find history files: ${historyFilesEither.reason}" } return ChangesEither.Unknown(BuildAttribute.DEP_CHANGE_HISTORY_IS_NOT_FOUND) } } @@ -89,20 +90,20 @@ internal fun getClasspathChanges( for (historyFile in historyFiles) { val allBuilds = BuildDiffsStorage.readDiffsFromFile(historyFile, reporter = reporter) ?: return run { - reporter.report { "Could not read diffs from $historyFile" } + reporter.info { "Could not read diffs from $historyFile" } ChangesEither.Unknown(BuildAttribute.DEP_CHANGE_HISTORY_CANNOT_BE_READ) } val (knownBuilds, newBuilds) = allBuilds.partition { it.ts <= lastBuildTS } if (knownBuilds.isEmpty()) { - reporter.report { "No previously known builds for $historyFile" } + reporter.info { "No previously known builds for $historyFile" } return ChangesEither.Unknown(BuildAttribute.DEP_CHANGE_HISTORY_NO_KNOWN_BUILDS) } for (buildDiff in newBuilds) { if (!buildDiff.isIncremental) { - reporter.report { "Non-incremental build from dependency $historyFile" } + reporter.info { "Non-incremental build from dependency $historyFile" } return ChangesEither.Unknown(BuildAttribute.DEP_CHANGE_NON_INCREMENTAL_BUILD_IN_DEP) } diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/classpathDiff/ClasspathChangesComputer.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/classpathDiff/ClasspathChangesComputer.kt index 361a78744b2..6b004c31184 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/classpathDiff/ClasspathChangesComputer.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/classpathDiff/ClasspathChangesComputer.kt @@ -7,6 +7,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.debug import org.jetbrains.kotlin.build.report.metrics.BuildMetricsReporter import org.jetbrains.kotlin.build.report.metrics.BuildTime import org.jetbrains.kotlin.build.report.metrics.measure @@ -52,7 +53,7 @@ object ClasspathChangesComputer { ) ) } - reporter.reportVerbose { + reporter.debug { "Shrunk current classpath snapshot for diffing," + " retained ${shrunkCurrentClasspathAgainstPreviousLookups.size} / ${currentClasspathSnapshot.size} classes" } @@ -61,7 +62,7 @@ object ClasspathChangesComputer { val shrunkPreviousClasspathSnapshot = reporter.measure(BuildTime.LOAD_SHRUNK_PREVIOUS_CLASSPATH_SNAPSHOT) { ListExternalizer(AccessibleClassSnapshotExternalizer).loadFromFile(classpathSnapshotFiles.shrunkPreviousClasspathSnapshotFile) } - reporter.reportVerbose { + reporter.debug { "Loaded shrunk previous classpath snapshot for diffing, found ${shrunkPreviousClasspathSnapshot.size} classes" } diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/classpathDiff/ClasspathSnapshotBuildReporter.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/classpathDiff/ClasspathSnapshotBuildReporter.kt index 3736102e0cc..b4b70d7b766 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/classpathDiff/ClasspathSnapshotBuildReporter.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/classpathDiff/ClasspathSnapshotBuildReporter.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.incremental.classpathDiff import org.jetbrains.kotlin.build.report.BuildReporter import org.jetbrains.kotlin.build.report.ICReporter +import org.jetbrains.kotlin.build.report.debug import org.jetbrains.kotlin.build.report.metrics.BuildMetricsReporter class ClasspathSnapshotBuildReporter(private val buildReporter: BuildReporter) : @@ -17,7 +18,7 @@ class ClasspathSnapshotBuildReporter(private val buildReporter: BuildReporter) : } fun reportVerboseWithLimit(maxLength: Int = 1000, message: () -> String) { - reportVerbose { + debug { message().let { if (it.length > maxLength) { it.substring(0, maxLength) + "... (string too long, showing $maxLength / ${it.length} chars)" diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/classpathDiff/ClasspathSnapshotShrinker.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/classpathDiff/ClasspathSnapshotShrinker.kt index 2567c1063a9..4a22ff39361 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/classpathDiff/ClasspathSnapshotShrinker.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/classpathDiff/ClasspathSnapshotShrinker.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.incremental.classpathDiff +import org.jetbrains.kotlin.build.report.debug import org.jetbrains.kotlin.build.report.metrics.BuildMetricsReporter import org.jetbrains.kotlin.build.report.metrics.BuildPerformanceMetric import org.jetbrains.kotlin.build.report.metrics.BuildTime @@ -308,7 +309,7 @@ internal fun shrinkAndSaveClasspathSnapshot( } } - reporter.reportVerbose { + reporter.debug { "Shrunk current classpath snapshot after compilation (shrink mode = ${shrinkMode::class.simpleName})" + when (shrinkMode) { is ShrinkMode.UnchangedLookupsUnchangedClasspath -> ", no updates since previous run" else -> ", retained ${shrunkCurrentClasspath!!.size} / ${currentClasspath!!.size} classes" diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt index 6bedcf6174c..ded9acdb143 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.build.GeneratedFile import org.jetbrains.kotlin.build.GeneratedJvmClass import org.jetbrains.kotlin.build.report.ICReporter.ReportSeverity import org.jetbrains.kotlin.build.report.ICReporterBase +import org.jetbrains.kotlin.build.report.debug import org.jetbrains.kotlin.cli.common.ExitCode import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.ERROR @@ -750,7 +751,7 @@ private fun ChangesCollector.processChangesUsingLookups( val allCaches = caches.flatMap { it.thisWithDependentCaches } val reporter = JpsICReporter() - reporter.reportVerbose { "Start processing changes" } + reporter.debug { "Start processing changes" } val dirtyFiles = getDirtyFiles(allCaches, lookupStorageManager) // if list of inheritors of sealed class has changed it should be recompiled with all the inheritors @@ -764,7 +765,7 @@ private fun ChangesCollector.processChangesUsingLookups( excludeFiles = excludeFiles ) - reporter.reportVerbose { "End of processing changes" } + reporter.debug { "End of processing changes" } } data class FilesToRecompile(val dirtyFiles: Set, val forceRecompileTogether: Set)