Follow-up commit for 1e7e42ba with refactoring

^KT-65043 Fixed
This commit is contained in:
Aleksei.Cherepanov
2024-01-17 09:29:59 +01:00
committed by Space Team
parent 86e6912447
commit a4a433fd65
2 changed files with 12 additions and 7 deletions
@@ -49,7 +49,7 @@ interface IncrementalCacheCommon {
*/
abstract class AbstractIncrementalCache<ClassName>(
workingDir: File,
val icContext: IncrementalCompilationContext,
protected val icContext: IncrementalCompilationContext,
) : BasicMapsOwner(workingDir), IncrementalCacheCommon {
companion object {
private const val CLASS_ATTRIBUTES = "class-attributes"
@@ -229,8 +229,6 @@ abstract class AbstractIncrementalCache<ClassName>(
}
override fun updateComplementaryFiles(dirtyFiles: Collection<File>, expectActualTracker: ExpectActualTrackerImpl) {
if (icContext.useCompilerMapsOnly && this is IncrementalJvmCache) return
dirtyFiles.forEach {
complementaryFilesMap.remove(it)
}
@@ -71,8 +71,10 @@ open class IncrementalJvmCache(
private val multifileFacadeToParts = registerMap(MultifileClassFacadeMap(MULTIFILE_CLASS_FACADES.storageFile, icContext))
private val partToMultifileFacade = registerMap(MultifileClassPartMap(MULTIFILE_CLASS_PARTS.storageFile, icContext))
private val inlineFunctionsMap = registerMap(InlineFunctionsMap(INLINE_FUNCTIONS.storageFile, icContext))
// todo: try to use internal names only?
private val internalNameToSource = registerMap(InternalNameToSourcesMap(INTERNAL_NAME_TO_SOURCE.storageFile, icContext))
// gradle only
private val javaSourcesProtoMap = registerMap(JavaSourcesProtoMap(JAVA_SOURCES_PROTO_MAP.storageFile, icContext))
@@ -101,6 +103,11 @@ open class IncrementalJvmCache(
return toSystemIndependentName(File(outputDir, "$internalClassName.class").normalize().absolutePath)
}
override fun updateComplementaryFiles(dirtyFiles: Collection<File>, expectActualTracker: ExpectActualTrackerImpl) {
if (icContext.useCompilerMapsOnly) return
super.updateComplementaryFiles(dirtyFiles, expectActualTracker)
}
fun saveModuleMappingToCache(sourceFiles: Collection<File>, file: File) {
val jvmClassName = JvmClassName.byInternalName(MODULE_MAPPING_FILE_NAME)
protoMap.storeModuleMapping(jvmClassName, file.readBytes())
@@ -204,7 +211,7 @@ open class IncrementalJvmCache(
classProto: ProtoBuf.Class,
stringTable: JvmStringTable,
sourceFiles: List<File>?,
changesCollector: ChangesCollector
changesCollector: ChangesCollector,
) {
val className = JvmClassName.byClassId(classId)
@@ -231,7 +238,7 @@ open class IncrementalJvmCache(
}
fun collectClassChangesByFeMetadata(
className: JvmClassName, classProto: ProtoBuf.Class, stringTable: JvmStringTable, changesCollector: ChangesCollector
className: JvmClassName, classProto: ProtoBuf.Class, stringTable: JvmStringTable, changesCollector: ChangesCollector,
) {
//class
feProtoMap.check(className, classProto, stringTable, changesCollector)
@@ -374,7 +381,7 @@ open class IncrementalJvmCache(
className: JvmClassName,
newMapValue: ProtoMapValue,
newProtoData: ProtoData,
changesCollector: ChangesCollector
changesCollector: ChangesCollector,
) {
val key = className.internalName
val oldMapValue = storage[key]
@@ -384,7 +391,7 @@ open class IncrementalJvmCache(
}
fun check(
className: JvmClassName, classProto: ProtoBuf.Class, stringTable: JvmStringTable, changesCollector: ChangesCollector
className: JvmClassName, classProto: ProtoBuf.Class, stringTable: JvmStringTable, changesCollector: ChangesCollector,
) {
val key = className.internalName
val oldProtoData = storage[key]?.toProtoData(className.packageFqName)