Clean only kotlin caches when incremental compilation is off
This commit is contained in:
@@ -137,18 +137,12 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
|
||||
val dataManager = projectDescriptor.dataManager
|
||||
|
||||
if (!IncrementalCompilation.isEnabled()) {
|
||||
dataManager.clean()
|
||||
dataManager.flush(true)
|
||||
}
|
||||
else {
|
||||
if (chunk.targets.any { dataManager.dataPaths.getKotlinCacheVersion(it).isIncompatible() }) {
|
||||
LOG.info("Clearing caches for " + chunk.targets.map { it.presentableName }.join())
|
||||
val incrementalCaches = getIncrementalCaches(chunk, context)
|
||||
incrementalCaches.values().forEach(StorageOwner::clean)
|
||||
FSOperations.markDirtyRecursively(context, CompilationRound.NEXT, chunk)
|
||||
return ADDITIONAL_PASS_REQUIRED
|
||||
}
|
||||
if (chunk.targets.any { dataManager.dataPaths.getKotlinCacheVersion(it).isIncompatible() }) {
|
||||
LOG.info("Clearing caches for " + chunk.targets.map { it.presentableName }.join())
|
||||
val incrementalCaches = getIncrementalCaches(chunk, context)
|
||||
incrementalCaches.values().forEach(StorageOwner::clean)
|
||||
FSOperations.markDirtyRecursively(context, CompilationRound.NEXT, chunk)
|
||||
return ADDITIONAL_PASS_REQUIRED
|
||||
}
|
||||
|
||||
if (!dirtyFilesHolder.hasDirtyFiles() && !dirtyFilesHolder.hasRemovedFiles()
|
||||
|
||||
@@ -38,9 +38,10 @@ class CacheFormatVersion(targetDataRoot: File) {
|
||||
private val file = File(targetDataRoot, FORMAT_VERSION_FILE_PATH)
|
||||
|
||||
fun isIncompatible(): Boolean {
|
||||
assert(IncrementalCompilation.isEnabled()) { "Incremental compilation is not enabled" }
|
||||
if (!file.exists()) return false
|
||||
|
||||
if (!IncrementalCompilation.isEnabled()) return true
|
||||
|
||||
val versionNumber = file.readText().toInt()
|
||||
|
||||
if (versionNumber != CACHE_FORMAT_VERSION) {
|
||||
|
||||
Reference in New Issue
Block a user