KT-45777: Clean up build cache tests for incremental compilation

- Clean up BuildCacheRelocationIT.testKotlinIncrementalCompilation
 - Delete BuildCacheIT.testKotlinCompileIncrementalBuildWithoutRelocation
   as it is already covered by the test in BuildCacheRelocationIT
 - Add BuildCacheRelocationIT.testKotlinIncrementalCompilation_withClasspathSnapshot
- Updated BuildCacheRelocationIT.testKotlinIncrementalCompilation_withClasspathSnapshot
This commit is contained in:
Hung Nguyen
2022-01-30 13:38:26 +03:00
committed by nataliya.valtman
parent 200cc9f75f
commit d018031cbf
16 changed files with 133 additions and 214 deletions
@@ -129,7 +129,15 @@ abstract class IncrementalCompilerRunner<
else -> providedChangedFiles
}
val compilationMode = sourcesToCompile(caches, changedFiles, args, messageCollector, classpathAbiSnapshot)
// Check whether the cache directory is populated (note that it may be deleted upon a Gradle build cache hit if the directory is
// marked as @LocalState in the Gradle task).
val cacheDirectoryNotPopulated = cacheDirectory.walk().none { it.isFile }
val compilationMode = if (cacheDirectoryNotPopulated) {
CompilationMode.Rebuild(BuildAttribute.CACHE_DIRECTORY_NOT_POPULATED)
} else {
sourcesToCompile(caches, changedFiles, args, messageCollector, classpathAbiSnapshot)
}
val exitCode = when (compilationMode) {
is CompilationMode.Incremental -> {
@@ -256,7 +256,7 @@ class IncrementalJvmCompilerRunner(
is NotAvailableDueToMissingClasspathSnapshot -> ChangesEither.Unknown(BuildAttribute.CLASSPATH_SNAPSHOT_NOT_FOUND)
is NotAvailableForNonIncrementalRun -> ChangesEither.Unknown(BuildAttribute.UNKNOWN_CHANGES_IN_GRADLE_INPUTS)
is ClasspathSnapshotDisabled -> reporter.measure(BuildTime.IC_ANALYZE_CHANGES_IN_DEPENDENCIES) {
val lastBuildInfo = BuildInfo.read(lastBuildInfoFile) ?: return CompilationMode.Rebuild(BuildAttribute.IC_IS_NOT_ENABLED)
val lastBuildInfo = BuildInfo.read(lastBuildInfoFile) ?: return CompilationMode.Rebuild(BuildAttribute.NO_BUILD_HISTORY)
reporter.reportVerbose { "Last Kotlin Build info -- $lastBuildInfo" }
val scopes = caches.lookupCache.lookupSymbols.map { it.scope.ifBlank { it.name } }.distinct()