KT-45777: Allow 2 levels of granularity when tracking changes

1. CLASS_LEVEL: allows tracking whether a .class file has changed
     without tracking what specific parts of the .class file (e.g.,
     fields or methods) have changed.

  2. CLASS_MEMBER_LEVEL: allows tracking not only whether a .class file
     has changed but also what specific parts of the .class file (e.g.,
     fields or methods) have changed.

 The idea is that for better performance we will use CLASS_LEVEL for
 classpath entries that are usually unchanged, and CLASS_MEMBER_LEVEL
 for classpath entries that are frequently changed. We'll work out the
 specifics in a following commit after some measurements.

Support running kotlinc on Windows in ClasspathSnapshotTestCommon
Also add tests for different Kotlin class kinds.
Add unit tests for CLASS_LEVEL snapshotting and diffing

Test: Updated ClasspathSnapshotterTest + ClasspathChangesComputerTest
Add ClasspathChangesComputerTest.testMixedClassSnapshotGranularities
This commit is contained in:
Hung Nguyen
2022-01-17 19:06:04 +00:00
committed by nataliya.valtman
parent 05457c291d
commit d2193f3873
76 changed files with 1170 additions and 566 deletions
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.gradle.internal.tasks.allOutputFiles
import org.jetbrains.kotlin.gradle.logging.GradleKotlinLogger
import org.jetbrains.kotlin.gradle.logging.kotlinDebug
import org.jetbrains.kotlin.incremental.cleanDirectoryContents
import org.jetbrains.kotlin.incremental.forceDeleteRecursively
import org.jetbrains.kotlin.incremental.deleteRecursivelyOrThrow
import java.io.File
fun throwGradleExceptionIfError(
@@ -63,7 +63,7 @@ internal fun cleanOutputsAndLocalState(
}
file.isFile -> {
log.debug("Deleting output file: $file")
file.forceDeleteRecursively()
file.deleteRecursivelyOrThrow()
}
}
}