Add cache comparator for incremental gradle tests

Add logic that rebuilds all sources after the last incremental round of each Gradle IC test and compares caches. The same was already implemented for JPS, but not for Gradle. After all rounds of incremental compilation are completed, another clean build from scratch is produced. All caches after the rebuild are compared with the caches of the last round of incremental compilation. This check is necessary because incremental compilation artifacts should depend on the state of the project, source files, and configuration, and not the chain of changes and incremental builds that led to this state. After the launch, there were several tests that did not satisfy the above conditions, and were muted  (KT-56681, KT-55195, KT-56242, KT-56698)

#KT-54991 In Progress
This commit is contained in:
Aleksei.Cherepanov
2023-03-23 14:27:13 +01:00
committed by Space Team
parent ae8428e8d0
commit 2e453051f9
16 changed files with 439 additions and 270 deletions
@@ -68,7 +68,7 @@ abstract class IncrementalCachesManager<PlatformCache : AbstractIncrementalCache
}
class IncrementalJvmCachesManager(
open class IncrementalJvmCachesManager(
icContext: IncrementalCompilationContext,
outputDir: File?,
cachesRootDir: File,
@@ -456,7 +456,7 @@ abstract class IncrementalCompilerRunner<
caches.platformCache.markDirty(dirtySources)
caches.inputsCache.removeOutputForSourceFiles(dirtySources)
val lookupTracker = LookupTrackerImpl(LookupTracker.DO_NOTHING)
val lookupTracker = LookupTrackerImpl(getLookupTrackerDelegate())
val expectActualTracker = ExpectActualTrackerImpl()
//TODO(valtman) sourceToCompile calculate based on abiSnapshot
val (sourcesToCompile, removedKotlinSources) = dirtySources.partition { it.exists() && allKotlinSources.contains(it) }
@@ -577,6 +577,8 @@ abstract class IncrementalCompilerRunner<
return exitCode
}
open fun getLookupTrackerDelegate(): LookupTracker = LookupTracker.DO_NOTHING
protected fun getRemovedClassesChanges(
caches: IncrementalCachesManager<*>,
changedFiles: ChangedFiles.Known
@@ -62,7 +62,7 @@ import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.progress.CompilationCanceledException
import java.io.File
class IncrementalFirJvmCompilerRunner(
open class IncrementalFirJvmCompilerRunner(
workingDir: File,
reporter: BuildReporter,
buildHistoryFile: File,