From 2e3d3a5117e7ed0f58f6142bcdebcb3867ad1432 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 12 Nov 2015 15:35:16 +0300 Subject: [PATCH] Minor: add more logging to KotlinBuilder Original commit: b7772f32ceedd2326f82d16d737a7e103a84c76c --- .../jetbrains/kotlin/jps/build/KotlinBuilder.kt | 14 ++++++++++++++ .../kotlin/jps/incremental/IncrementalCacheImpl.kt | 13 ++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) 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 c50acc74e42..a7babd80097 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 @@ -90,6 +90,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR override fun buildStarted(context: CompileContext) { LOG.debug("==========================================") LOG.info("is Kotlin incremental compilation enabled: ${IncrementalCompilation.isEnabled()}") + LOG.info("is Kotlin experimental incremental compilation enabled: ${IncrementalCompilation.isExperimental()}") val historyLabel = context.getBuilderParameter("history label") if (historyLabel != null) { @@ -165,6 +166,9 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR val allCompiledFiles = getAllCompiledFilesContainer(context) val filesToCompile = KotlinSourceFileCollector.getDirtySourceFiles(dirtyFilesHolder) + + LOG.debug("Compiling files: ${filesToCompile.values()}") + val start = System.nanoTime() val outputItemCollector = doCompileModuleChunk(allCompiledFiles, chunk, commonArguments, context, dirtyFilesHolder, environment, filesToCompile, incrementalCaches, messageCollector, project) @@ -233,6 +237,8 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR fun isKotlin(file: File) = KotlinSourceFileCollector.isKotlinSourceFile(file) fun isNotCompiled(file: File) = file !in allCompiledFiles + LOG.debug("compilationResult = $this") + when { inlineAdded -> { allCompiledFiles.clear() @@ -256,8 +262,11 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR fun CompilationResult.doProcessChangesUsingLookups() { val lookupStorage = dataManager.getStorage(KotlinDataContainerTarget, LookupStorageProvider) + LOG.debug("Start processing changes") + // TODO group by fqName? for (change in changes) { + LOG.debug("Process $change") if (change !is ChangeInfo.MembersChanged) continue @@ -266,12 +275,17 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR .asSequence() .map { File(it) } .filter { it !in compiledFiles && it.exists() } + .toList() + + LOG.debug("Mark dirty files: $files") files.forEach { FSOperations.markDirty(context, CompilationRound.NEXT, it) } } + LOG.debug("End of processing changes") + caches.forEach { it.cleanDirtyInlineFunctions() } } diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/IncrementalCacheImpl.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/IncrementalCacheImpl.kt index 78f0baed915..7e33f356920 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/IncrementalCacheImpl.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/IncrementalCacheImpl.kt @@ -646,9 +646,20 @@ public class IncrementalCacheImpl( } sealed class ChangeInfo(val fqName: FqName) { - open class MembersChanged(fqName: FqName, val names: Collection) : ChangeInfo(fqName) + open class MembersChanged(fqName: FqName, val names: Collection) : ChangeInfo(fqName) { + override fun toStringProperties(): String = super.toStringProperties() + ", names = $names" + } + class Removed(fqName: FqName, names: Collection) : MembersChanged(fqName, names) + class SignatureChanged(fqName: FqName) : ChangeInfo(fqName) + + + protected open fun toStringProperties(): String = "fqName = $fqName" + + override fun toString(): String { + return this.javaClass.simpleName + "(${toStringProperties()})" + } } data class CompilationResult(