Introduce IncrementalCompilerRunner#markDirty

This commit is contained in:
Alexey Tsvetkov
2017-08-29 00:03:24 +03:00
parent 53d911ab99
commit 65529fa866
4 changed files with 9 additions and 7 deletions
@@ -28,7 +28,7 @@ import java.io.File
/**
* Incremental cache common for JVM and JS
*/
open class IncrementalCacheCommon(workingDir: File) : BasicMapsOwner(workingDir) {
abstract class IncrementalCacheCommon(workingDir: File) : BasicMapsOwner(workingDir) {
companion object {
private val SUBTYPES = "subtypes"
private val SUPERTYPES = "supertypes"
@@ -55,6 +55,8 @@ open class IncrementalCacheCommon(workingDir: File) : BasicMapsOwner(workingDir)
fun getSourceFileIfClass(fqName: FqName): File? =
classFqNameToSourceMap[fqName]
abstract fun markDirty(removedAndCompiledSources: List<File>)
protected fun addToClassStorage(proto: ProtoBuf.Class, nameResolver: NameResolver, srcFile: File) {
val supertypes = proto.supertypes(TypeTable(proto.typeTable))
val parents = supertypes.map { nameResolver.getClassId(it.className).asSingleFqName() }
@@ -80,7 +80,7 @@ open class IncrementalCacheImpl(
protected open fun debugLog(message: String) {}
fun markOutputClassesDirty(removedAndCompiledSources: List<File>) {
override fun markDirty(removedAndCompiledSources: List<File>) {
for (sourceFile in removedAndCompiledSources) {
val classes = sourceToClassesMap[sourceFile]
classes.forEach {
@@ -131,7 +131,8 @@ abstract class IncrementalCompilerRunner<
}
}
protected open fun markOutputDirty(caches: CacheManager, dirtySources: List<File>) {
protected open fun markDirty(caches: CacheManager, dirtySources: List<File>) {
caches.platformCache.markDirty(dirtySources)
}
protected abstract fun compareAndUpdateCache(caches: CacheManager, generatedFiles: List<GeneratedFile>): CompilationResult
@@ -175,7 +176,7 @@ abstract class IncrementalCompilerRunner<
val allGeneratedFiles = hashSetOf<GeneratedFile>()
while (dirtySources.any()) {
markOutputDirty(caches, dirtySources)
caches.platformCache.markDirty(dirtySources)
caches.inputsCache.removeOutputForSourceFiles(dirtySources)
val lookupTracker = LookupTrackerImpl(LookupTracker.DO_NOTHING)
@@ -196,10 +196,9 @@ class IncrementalJvmCompilerRunner(
}
private var outdatedClasses: Iterable<JvmClassName> = emptyList()
override fun markOutputDirty(caches: IncrementalJvmCachesManager, dirtySources: List<File>) {
override fun markDirty(caches: IncrementalJvmCachesManager, dirtySources: List<File>) {
outdatedClasses = caches.platformCache.classesBySources(dirtySources)
caches.platformCache.markOutputClassesDirty(dirtySources)
super.markOutputDirty(caches, dirtySources)
super.markDirty(caches, dirtySources)
}
override fun postCompilationHook(exitCode: ExitCode) {