Create map so it will always be added to maps

This commit is contained in:
Alexey Tsvetkov
2015-09-22 15:30:23 +03:00
parent a611dd9d25
commit 5c9b962567
@@ -107,39 +107,40 @@ public class IncrementalCacheImpl(
private val target: ModuleBuildTarget private val target: ModuleBuildTarget
) : StorageOwner, IncrementalCache { ) : StorageOwner, IncrementalCache {
companion object { companion object {
val PROTO_MAP = "proto.tab" val CACHE_EXTENSION = "tab"
val CONSTANTS_MAP = "constants.tab"
val INLINE_FUNCTIONS = "inline-functions.tab" private val PROTO_MAP = "proto"
val PACKAGE_PARTS = "package-parts.tab" private val CONSTANTS_MAP = "constants"
val SOURCE_TO_CLASSES = "source-to-classes.tab" private val INLINE_FUNCTIONS = "inline-functions"
val DIRTY_OUTPUT_CLASSES = "dirty-output-classes.tab" private val PACKAGE_PARTS = "package-parts"
val DIRTY_INLINE_FUNCTIONS = "dirty-inline-functions.tab" private val SOURCE_TO_CLASSES = "source-to-classes"
val INLINED_TO = "inlined-to.tab" private val DIRTY_OUTPUT_CLASSES = "dirty-output-classes"
private val DIRTY_INLINE_FUNCTIONS = "dirty-inline-functions"
private val INLINED_TO = "inlined-to"
private val MODULE_MAPPING_FILE_NAME = "." + ModuleMapping.MAPPING_FILE_EXT private val MODULE_MAPPING_FILE_NAME = "." + ModuleMapping.MAPPING_FILE_EXT
} }
private val baseDir = File(targetDataRoot, CACHE_DIRECTORY_NAME) private val baseDir = File(targetDataRoot, CACHE_DIRECTORY_NAME)
private val maps = arrayListOf<BasicMap<*, *>>()
private val String.storageFile: File private val String.storageFile: File
get() = File(baseDir, this) get() = File(baseDir, this + "." + CACHE_EXTENSION)
private val protoMap = ProtoMap(PROTO_MAP.storageFile) private fun <K, V, M : BasicMap<K, V>> registerMap(map: M): M {
private val constantsMap = ConstantsMap(CONSTANTS_MAP.storageFile) maps.add(map)
private val inlineFunctionsMap = InlineFunctionsMap(INLINE_FUNCTIONS.storageFile) return map
private val packagePartMap = PackagePartMap(PACKAGE_PARTS.storageFile) }
private val sourceToClassesMap = SourceToClassesMap(SOURCE_TO_CLASSES.storageFile)
private val dirtyOutputClassesMap = DirtyOutputClassesMap(DIRTY_OUTPUT_CLASSES.storageFile)
private val dirtyInlineFunctionsMap = DirtyInlineFunctionsMap(DIRTY_INLINE_FUNCTIONS.storageFile)
private val inlinedTo = InlineFunctionsFilesMap(INLINED_TO.storageFile)
private val maps = listOf(protoMap, private val protoMap = registerMap(ProtoMap(PROTO_MAP.storageFile))
constantsMap, private val constantsMap = registerMap(ConstantsMap(CONSTANTS_MAP.storageFile))
inlineFunctionsMap, private val inlineFunctionsMap = registerMap(InlineFunctionsMap(INLINE_FUNCTIONS.storageFile))
packagePartMap, private val packagePartMap = registerMap(PackagePartMap(PACKAGE_PARTS.storageFile))
sourceToClassesMap, private val sourceToClassesMap = registerMap(SourceToClassesMap(SOURCE_TO_CLASSES.storageFile))
dirtyOutputClassesMap, private val dirtyOutputClassesMap = registerMap(DirtyOutputClassesMap(DIRTY_OUTPUT_CLASSES.storageFile))
inlinedTo) // TODO: can be removed?
private val dirtyInlineFunctionsMap = registerMap(DirtyInlineFunctionsMap(DIRTY_INLINE_FUNCTIONS.storageFile))
private val inlinedTo = registerMap(InlineFunctionsFilesMap(INLINED_TO.storageFile))
private val cacheFormatVersion = CacheFormatVersion(targetDataRoot) private val cacheFormatVersion = CacheFormatVersion(targetDataRoot)
private val dependents = arrayListOf<IncrementalCacheImpl>() private val dependents = arrayListOf<IncrementalCacheImpl>()