[IC] Fix fallback logic in IncrementalCompilerRunner

The current logic works as follows:
- Try either incremental compilation or non-incremental compilation
- If the above (or any of its surrounding work) fails, fall back to
  non-incremental compilation

This means we may perform non-incremental compilation twice.

This commit will fix that logic so that we fall back to non-incremental
compilation only if *incremental compilation* fails.

A nice consequence of this change is that it also resolves the critical
bugs described at KT-52669 (which occur because the current logic is
flawed).

#KT-52669 Fixed
This commit is contained in:
Hung Nguyen
2022-06-08 15:13:37 +01:00
committed by teamcity
parent 771c322d21
commit 46c769deb6
4 changed files with 94 additions and 89 deletions
@@ -700,7 +700,7 @@ abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilation
}
build("assemble") {
assertOutputContains("Non-incremental compilation will be performed: CACHE_CORRUPTION")
assertOutputContains("Non-incremental compilation will be performed: INCREMENTAL_COMPILATION_FAILED")
}
val lookupFile = projectPath.resolve("lib/build/kotlin/${compileKotlinTaskName}/cacheable/${compileCacheFolderName}/lookups/file-to-id.tab")