Minor: change formatting, add logging

KT-8487
This commit is contained in:
Alexey Tsvetkov
2016-02-05 16:36:59 +03:00
parent a13cf73a5b
commit a5e3ca3596
@@ -401,18 +401,14 @@ open class KotlinCompile() : AbstractKotlinCompile<K2JVMCompilerArguments>() {
} }
} }
fun outputRelativePath(f: File) = f.toRelativeString(outputDir)
if (!experimentalIncremental) { if (!experimentalIncremental) {
anyClassesCompiled = true anyClassesCompiled = true
processCompilerExitCode(compileNotIncremental(sources, outputDir, args)) processCompilerExitCode(compileNotIncremental(sources, outputDir, args))
return return
} }
logger.warn("Using experimental kotlin incremental compilation") logger.warn("Using experimental kotlin incremental compilation")
anyClassesCompiled = false anyClassesCompiled = false
// TODO: decide what to do if no files are considered dirty - rebuild or skip the module // TODO: decide what to do if no files are considered dirty - rebuild or skip the module
var (sourcesToCompile, isIncrementalDecided) = calculateSourcesToCompile() var (sourcesToCompile, isIncrementalDecided) = calculateSourcesToCompile()
@@ -424,20 +420,17 @@ open class KotlinCompile() : AbstractKotlinCompile<K2JVMCompilerArguments>() {
while (sourcesToCompile.any()) { while (sourcesToCompile.any()) {
logger.kotlinInfo("compile iteration: ${sourcesToCompile.joinToString{ projectRelativePath(it) }}") logger.kotlinInfo("compile iteration: ${sourcesToCompile.joinToString{ projectRelativePath(it) }}")
val (exitCode, generatedFiles) = compileChanged( val (existingSource, nonExistingSource) = sourcesToCompile.partition { it.isFile }
targets = targets, if (nonExistingSource.any()) {
sourcesToCompile = sourcesToCompile, logger.warn("Kotlin incremental compilation tried to compile removed files: $nonExistingSource")
outputDir = outputDir, }
args = args,
getIncrementalCache = ::getIncrementalCache, val (exitCode, generatedFiles) = compileChanged(targets, existingSource.toSet(), outputDir, args, ::getIncrementalCache, lookupTracker)
lookupTracker = lookupTracker)
allGeneratedFiles.addAll(generatedFiles) allGeneratedFiles.addAll(generatedFiles)
val changes = updateIncrementalCaches( val changes = updateIncrementalCaches(targets, generatedFiles,
targets = targets, compiledWithErrors = exitCode != ExitCode.OK,
generatedFiles = generatedFiles, getIncrementalCache = { caches[it]!! })
compiledWithErrors = exitCode != ExitCode.OK,
getIncrementalCache = { caches[it]!! })
lookupStorage.update(lookupTracker, sourcesToCompile, currentRemoved) lookupStorage.update(lookupTracker, sourcesToCompile, currentRemoved)
allCachesVersions().forEach { it.saveIfNeeded() } allCachesVersions().forEach { it.saveIfNeeded() }