From a5e3ca35965b3dbc421bf74b22f5be9eadb9451d Mon Sep 17 00:00:00 2001 From: Alexey Tsvetkov Date: Fri, 5 Feb 2016 16:36:59 +0300 Subject: [PATCH] Minor: change formatting, add logging KT-8487 --- .../jetbrains/kotlin/gradle/tasks/Tasks.kt | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-core/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt b/libraries/tools/kotlin-gradle-plugin-core/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt index 7106a55dee6..eb0d9a3f66d 100644 --- a/libraries/tools/kotlin-gradle-plugin-core/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt +++ b/libraries/tools/kotlin-gradle-plugin-core/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt @@ -401,18 +401,14 @@ open class KotlinCompile() : AbstractKotlinCompile() { } } - fun outputRelativePath(f: File) = f.toRelativeString(outputDir) - - if (!experimentalIncremental) { anyClassesCompiled = true processCompilerExitCode(compileNotIncremental(sources, outputDir, args)) return } + logger.warn("Using experimental kotlin incremental compilation") - anyClassesCompiled = false - // TODO: decide what to do if no files are considered dirty - rebuild or skip the module var (sourcesToCompile, isIncrementalDecided) = calculateSourcesToCompile() @@ -424,20 +420,17 @@ open class KotlinCompile() : AbstractKotlinCompile() { while (sourcesToCompile.any()) { logger.kotlinInfo("compile iteration: ${sourcesToCompile.joinToString{ projectRelativePath(it) }}") - val (exitCode, generatedFiles) = compileChanged( - targets = targets, - sourcesToCompile = sourcesToCompile, - outputDir = outputDir, - args = args, - getIncrementalCache = ::getIncrementalCache, - lookupTracker = lookupTracker) + val (existingSource, nonExistingSource) = sourcesToCompile.partition { it.isFile } + if (nonExistingSource.any()) { + logger.warn("Kotlin incremental compilation tried to compile removed files: $nonExistingSource") + } + + val (exitCode, generatedFiles) = compileChanged(targets, existingSource.toSet(), outputDir, args, ::getIncrementalCache, lookupTracker) allGeneratedFiles.addAll(generatedFiles) - val changes = updateIncrementalCaches( - targets = targets, - generatedFiles = generatedFiles, - compiledWithErrors = exitCode != ExitCode.OK, - getIncrementalCache = { caches[it]!! }) + val changes = updateIncrementalCaches(targets, generatedFiles, + compiledWithErrors = exitCode != ExitCode.OK, + getIncrementalCache = { caches[it]!! }) lookupStorage.update(lookupTracker, sourcesToCompile, currentRemoved) allCachesVersions().forEach { it.saveIfNeeded() }