Remove old IC: remove experimental cache version

This commit is contained in:
Alexey Tsvetkov
2017-05-02 19:39:32 +03:00
parent a4a0335b20
commit 534db2d45b
18 changed files with 6 additions and 56 deletions
@@ -24,11 +24,9 @@ import java.io.File
import java.io.IOException
private val NORMAL_VERSION = 8
private val EXPERIMENTAL_VERSION = 4
private val DATA_CONTAINER_VERSION = 2
private val NORMAL_VERSION_FILE_NAME = "format-version.txt"
private val EXPERIMENTAL_VERSION_FILE_NAME = "experimental-format-version.txt"
private val DATA_CONTAINER_VERSION_FILE_NAME = "data-container-format-version.txt"
class CacheVersion(
@@ -92,7 +90,6 @@ class CacheVersion(
REBUILD_ALL_KOTLIN,
REBUILD_CHUNK,
CLEAN_NORMAL_CACHES,
CLEAN_EXPERIMENTAL_CACHES,
CLEAN_DATA_CONTAINER,
DO_NOTHING
}
@@ -106,14 +103,6 @@ fun normalCacheVersion(dataRoot: File): CacheVersion =
whenTurnedOff = CacheVersion.Action.CLEAN_NORMAL_CACHES,
isEnabled = { IncrementalCompilation.isEnabled() })
fun experimentalCacheVersion(dataRoot: File): CacheVersion =
CacheVersion(ownVersion = EXPERIMENTAL_VERSION,
versionFile = File(dataRoot, EXPERIMENTAL_VERSION_FILE_NAME),
whenVersionChanged = CacheVersion.Action.REBUILD_CHUNK,
whenTurnedOn = CacheVersion.Action.REBUILD_CHUNK,
whenTurnedOff = CacheVersion.Action.CLEAN_EXPERIMENTAL_CACHES,
isEnabled = { IncrementalCompilation.isEnabled() })
fun dataContainerCacheVersion(dataRoot: File): CacheVersion =
CacheVersion(ownVersion = DATA_CONTAINER_VERSION,
versionFile = File(dataRoot, DATA_CONTAINER_VERSION_FILE_NAME),
@@ -73,12 +73,6 @@ open class IncrementalCacheImpl<Target>(
}
private val baseDir = File(targetDataRoot, KOTLIN_CACHE_DIRECTORY_NAME)
private val experimentalMaps = arrayListOf<BasicMap<*, *>>()
private fun <K, V, M : BasicMap<K, V>> registerExperimentalMap(map: M): M {
experimentalMaps.add(map)
return registerMap(map)
}
protected val String.storageFile: File
get() = File(baseDir, this + "." + CACHE_EXTENSION)
@@ -91,11 +85,11 @@ open class IncrementalCacheImpl<Target>(
private val sourceToClassesMap = registerMap(SourceToClassesMap(SOURCE_TO_CLASSES.storageFile))
private val dirtyOutputClassesMap = registerMap(DirtyOutputClassesMap(DIRTY_OUTPUT_CLASSES.storageFile))
private val inlineFunctionsMap = registerMap(InlineFunctionsMap(INLINE_FUNCTIONS.storageFile))
private val subtypesMap = registerExperimentalMap(SubtypesMap(SUBTYPES.storageFile))
private val supertypesMap = registerExperimentalMap(SupertypesMap(SUPERTYPES.storageFile))
private val classFqNameToSourceMap = registerExperimentalMap(ClassFqNameToSourceMap(CLASS_FQ_NAME_TO_SOURCE.storageFile))
private val subtypesMap = registerMap(SubtypesMap(SUBTYPES.storageFile))
private val supertypesMap = registerMap(SupertypesMap(SUPERTYPES.storageFile))
private val classFqNameToSourceMap = registerMap(ClassFqNameToSourceMap(CLASS_FQ_NAME_TO_SOURCE.storageFile))
// todo: try to use internal names only?
private val internalNameToSource = registerExperimentalMap(InternalNameToSourcesMap(INTERNAL_NAME_TO_SOURCE.storageFile))
private val internalNameToSource = registerMap(InternalNameToSourcesMap(INTERNAL_NAME_TO_SOURCE.storageFile))
private val dependents = arrayListOf<IncrementalCacheImpl<Target>>()
private val outputDir by lazy(LazyThreadSafetyMode.NONE) { requireNotNull(targetOutputDir) { "Target is expected to have output directory: $target" } }
@@ -365,12 +359,6 @@ open class IncrementalCacheImpl<Target>(
override fun clean() {
super.clean()
normalCacheVersion(targetDataRoot).clean()
experimentalCacheVersion(targetDataRoot).clean()
}
fun cleanExperimental() {
experimentalCacheVersion(targetDataRoot).clean()
experimentalMaps.forEach { it.clean() }
}
private inner class ProtoMap(storageFile: File) : BasicStringMap<ProtoMapValue>(storageFile, ProtoMapValueExternalizer) {
@@ -35,5 +35,4 @@ fun customCacheVersion(version: Int, fileName: String, dataRoot: File, forceEnab
fun commonCacheVersions(cachesDir: File): List<CacheVersion> =
listOf(normalCacheVersion(cachesDir),
experimentalCacheVersion(cachesDir),
dataContainerCacheVersion(cachesDir))
@@ -82,7 +82,6 @@ abstract class AbstractIncrementalLazyCachesTest : AbstractIncrementalJpsTest()
val jvmMetaBuildInfo = jvmBuildMetaInfoFile(target, dataManager)
dumpCachesForTarget(p, paths, target,
versions.normalVersion(target).formatVersionFile,
versions.experimentalVersion(target).formatVersionFile,
jvmMetaBuildInfo,
subdirectory = KOTLIN_CACHE_DIRECTORY_NAME)
}
@@ -23,8 +23,6 @@ import org.jetbrains.kotlin.jps.incremental.CacheVersionProvider
abstract class AbstractExperimentalIncrementalJpsTest : AbstractIncrementalJpsTest()
abstract class AbstractExperimentalIncrementalCacheVersionChangedTest : AbstractIncrementalCacheVersionChangedTest() {
override fun getVersions(cacheVersionProvider: CacheVersionProvider, targets: Iterable<ModuleBuildTarget>) =
targets.map { cacheVersionProvider.experimentalVersion(it) }
}
abstract class AbstractDataContainerVersionChangedTest : AbstractExperimentalIncrementalCacheVersionChangedTest() {
@@ -370,13 +370,6 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
dataManager.getKotlinCache(target).clean()
}
}
CacheVersion.Action.CLEAN_EXPERIMENTAL_CACHES -> {
LOG.info("Clearing experimental caches for all targets")
for (target in allTargets) {
dataManager.getKotlinCache(target).cleanExperimental()
}
}
CacheVersion.Action.CLEAN_DATA_CONTAINER -> {
LOG.info("Clearing lookup cache")
dataManager.getStorage(KotlinDataContainerTarget, JpsLookupStorageProvider).clean()
@@ -21,7 +21,6 @@ import org.jetbrains.jps.builders.storage.BuildDataPaths
import org.jetbrains.jps.incremental.ModuleBuildTarget
import org.jetbrains.kotlin.incremental.CacheVersion
import org.jetbrains.kotlin.incremental.dataContainerCacheVersion
import org.jetbrains.kotlin.incremental.experimentalCacheVersion
import org.jetbrains.kotlin.incremental.normalCacheVersion
import java.io.File
@@ -32,8 +31,6 @@ class CacheVersionProvider(private val paths: BuildDataPaths) {
fun normalVersion(target: ModuleBuildTarget): CacheVersion = normalCacheVersion(target.dataRoot)
fun experimentalVersion(target: ModuleBuildTarget): CacheVersion = experimentalCacheVersion(target.dataRoot)
fun dataContainerVersion(): CacheVersion = dataContainerCacheVersion(KotlinDataContainerTarget.dataRoot)
fun allVersions(targets: Iterable<ModuleBuildTarget>): Iterable<CacheVersion> {
@@ -42,7 +39,6 @@ class CacheVersionProvider(private val paths: BuildDataPaths) {
for (dataRoot in targets.map { it.dataRoot }) {
versions.add(normalCacheVersion(dataRoot))
versions.add(experimentalCacheVersion(dataRoot))
}
return versions
@@ -1,7 +1,7 @@
================ Step #1 =================
Building module1
Actions after cache changed: [CLEAN_NORMAL_CACHES, CLEAN_EXPERIMENTAL_CACHES, CLEAN_DATA_CONTAINER]
Actions after cache changed: [CLEAN_NORMAL_CACHES, CLEAN_DATA_CONTAINER]
Exit code: NOTHING_DONE
------------------------------------------
Building module2
@@ -1,7 +1,7 @@
================ Step #1 =================
Building module1
Actions after cache changed: [CLEAN_NORMAL_CACHES, CLEAN_EXPERIMENTAL_CACHES, CLEAN_DATA_CONTAINER]
Actions after cache changed: [CLEAN_NORMAL_CACHES, CLEAN_DATA_CONTAINER]
Exit code: NOTHING_DONE
------------------------------------------
Building module2
@@ -5,7 +5,6 @@ kotlin-data-container
id-to-file.tab
lookups.tab
Module 'module1' production
experimental-format-version.txt
format-version.txt
jvm-build-meta-info.txt
class-fq-name-to-source.tab
@@ -14,7 +13,6 @@ Module 'module1' production
source-to-classes.tab
Module 'module1' tests
Module 'module2' production
experimental-format-version.txt
format-version.txt
jvm-build-meta-info.txt
inline-functions.tab
@@ -24,7 +22,6 @@ Module 'module2' production
source-to-classes.tab
Module 'module2' tests
Module 'module3' production
experimental-format-version.txt
format-version.txt
jvm-build-meta-info.txt
class-fq-name-to-source.tab
@@ -33,7 +30,6 @@ Module 'module3' production
source-to-classes.tab
Module 'module3' tests
Module 'module4' production
experimental-format-version.txt
format-version.txt
jvm-build-meta-info.txt
class-fq-name-to-source.tab
@@ -5,7 +5,6 @@ kotlin-data-container
id-to-file.tab
lookups.tab
Module 'module' production
experimental-format-version.txt
format-version.txt
jvm-build-meta-info.txt
class-fq-name-to-source.tab
@@ -5,7 +5,6 @@ kotlin-data-container
id-to-file.tab
lookups.tab
Module 'module' production
experimental-format-version.txt
format-version.txt
jvm-build-meta-info.txt
class-fq-name-to-source.tab
@@ -5,7 +5,6 @@ kotlin-data-container
id-to-file.tab
lookups.tab
Module 'module' production
experimental-format-version.txt
format-version.txt
jvm-build-meta-info.txt
constants.tab
@@ -5,7 +5,6 @@ kotlin-data-container
id-to-file.tab
lookups.tab
Module 'module' production
experimental-format-version.txt
format-version.txt
jvm-build-meta-info.txt
internal-name-to-source.tab
@@ -5,7 +5,6 @@ kotlin-data-container
id-to-file.tab
lookups.tab
Module 'module' production
experimental-format-version.txt
format-version.txt
jvm-build-meta-info.txt
inline-functions.tab
@@ -5,7 +5,6 @@ kotlin-data-container
id-to-file.tab
lookups.tab
Module 'module' production
experimental-format-version.txt
format-version.txt
jvm-build-meta-info.txt
inline-functions.tab
@@ -5,7 +5,6 @@ kotlin-data-container
id-to-file.tab
lookups.tab
Module 'module' production
experimental-format-version.txt
format-version.txt
jvm-build-meta-info.txt
internal-name-to-source.tab
@@ -210,7 +210,6 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
get() = File(File(project.buildDir, KOTLIN_BUILD_DIR_NAME), name).apply { mkdirs() }
private val cacheVersions by lazy {
listOf(normalCacheVersion(taskBuildDirectory),
experimentalCacheVersion(taskBuildDirectory),
dataContainerCacheVersion(taskBuildDirectory),
gradleCacheVersion(taskBuildDirectory))
}