[IC] Refactor IC maps to reuse code and ensure consistency
The key changes include:
- Top interface: `PersistentStorage`
- Implementation:
+ `LazyStorage`
+ `InMemoryStorage`
- Extended functionality:
+ `BasicMap`
+ `PersistentStorageAdapter`
The remaining changes are small cleanups to adapt to the above key
changes.
Test: Existing tests (refactoring change)
Bug: N/A (code cleanup)
This commit is contained in:
-2
@@ -60,8 +60,6 @@ abstract class IncrementalCachesManager<PlatformCache : AbstractIncrementalCache
|
||||
private class CacheCloser(private val cache: BasicMapsOwner) : Closeable {
|
||||
|
||||
override fun close() {
|
||||
// It's important to flush the cache when closing (see KT-53168)
|
||||
cache.flush(memoryCachesOnly = false)
|
||||
cache.close()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -14,7 +14,8 @@ class SourceToOutputFilesMap(
|
||||
icContext: IncrementalCompilationContext,
|
||||
) : BasicStringMap<Collection<String>>(storageFile, PathStringDescriptor, StringCollectionExternalizer, icContext) {
|
||||
operator fun set(sourceFile: File, outputFiles: Collection<File>) {
|
||||
storage[icContext.pathConverterForSourceFiles.toPath(sourceFile)] = outputFiles.map(icContext.pathConverterForOutputFiles::toPath)
|
||||
storage[icContext.pathConverterForSourceFiles.toPath(sourceFile)] =
|
||||
outputFiles.toSet().map(icContext.pathConverterForOutputFiles::toPath)
|
||||
}
|
||||
|
||||
operator fun get(sourceFile: File): Collection<File>? =
|
||||
|
||||
+1
-2
@@ -32,8 +32,7 @@ class FileSnapshotMapTest : TestWithWorkingDir() {
|
||||
|
||||
@After
|
||||
override fun tearDown() {
|
||||
snapshotMap.flush(false)
|
||||
snapshotMap.closeForTest()
|
||||
snapshotMap.close()
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -50,8 +50,7 @@ class SourceToOutputFilesMapTest {
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
stofMap.flush(false)
|
||||
stofMap.closeForTest()
|
||||
stofMap.close()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user