diff --git a/jps/jps-plugin/src/org/jetbrains/jet/jps/incremental/IncrementalCacheImpl.kt b/jps/jps-plugin/src/org/jetbrains/jet/jps/incremental/IncrementalCacheImpl.kt index fb71bfd94b5..5a42f4e58bb 100644 --- a/jps/jps-plugin/src/org/jetbrains/jet/jps/incremental/IncrementalCacheImpl.kt +++ b/jps/jps-plugin/src/org/jetbrains/jet/jps/incremental/IncrementalCacheImpl.kt @@ -74,13 +74,14 @@ public class IncrementalCacheImpl(val baseDir: File): IncrementalCache { if (header.syntheticClassKind == JvmAnnotationNames.KotlinSyntheticClass.Kind.PACKAGE_PART) { assert(sourceFiles.size == 1) { "Package part from several source files: $sourceFiles" } packagePartMap.putPackagePartSourceData(moduleId, sourceFiles.first(), className) - return constantsMap.process(className, fileBytes) + return constantsMap.process(moduleId, sourceFiles.first(), fileBytes) } return false } public fun clearCacheForRemovedFile(moduleId: String, sourceFile: File) { + constantsMap.remove(moduleId, sourceFile) packagePartMap.remove(moduleId, sourceFile) } @@ -135,6 +136,10 @@ public class IncrementalCacheImpl(val baseDir: File): IncrementalCache { ConstantsMapExternalizer ) + private fun getKey(moduleId: String, sourceFile: File): String { + return moduleId + File.pathSeparator + sourceFile.getAbsolutePath() + } + private fun getConstantsMap(bytes: ByteArray): Map { val result = HashMap() @@ -150,12 +155,12 @@ public class IncrementalCacheImpl(val baseDir: File): IncrementalCache { return result } - public fun process(packagePartClass: JvmClassName, bytes: ByteArray): Boolean { - return put(packagePartClass, getConstantsMap(bytes)) + public fun process(moduleId: String, file: File, bytes: ByteArray): Boolean { + return put(moduleId, file, getConstantsMap(bytes)) } - private fun put(packagePartClass: JvmClassName, constantsMap: Map): Boolean { - val key = packagePartClass.getInternalName() + private fun put(moduleId: String, file: File, constantsMap: Map): Boolean { + val key = getKey(moduleId, file) val oldMap = map[key] if (oldMap == constantsMap) { @@ -165,6 +170,10 @@ public class IncrementalCacheImpl(val baseDir: File): IncrementalCache { return true } + public fun remove(moduleId: String, file: File) { + map.remove(getKey(moduleId, file)) + } + public fun close() { map.close() }