Recompile all subclasses of removed classes

This commit is contained in:
Alexey Tsvetkov
2017-12-07 03:12:32 +03:00
parent e8162cd99d
commit a31f503fa5
6 changed files with 92 additions and 3 deletions
@@ -88,11 +88,17 @@ abstract class IncrementalCacheCommon<ClassName>(workingDir: File) : BasicMapsOw
abstract fun clearCacheForRemovedClasses(changesCollector: ChangesCollector)
protected fun removeAllFromClassStorage(removedClasses: Collection<FqName>) {
protected fun removeAllFromClassStorage(removedClasses: Collection<FqName>, changesCollector: ChangesCollector) {
if (removedClasses.isEmpty()) return
val removedFqNames = removedClasses.toSet()
for (removedClass in removedFqNames) {
for (affectedClass in withSubtypes(removedClass, thisWithDependentCaches)) {
changesCollector.collectSignature(affectedClass, areSubclassesAffected = false)
}
}
for (cache in thisWithDependentCaches) {
val parentsFqNames = hashSetOf<FqName>()
val childrenFqNames = hashSetOf<FqName>()
@@ -100,7 +100,7 @@ open class IncrementalJsCache(cachesDir: File) : IncrementalCacheCommon<FqName>(
translationResults.remove(it, changesCollector)
inlineFunctions.remove(it)
}
removeAllFromClassStorage(dirtyOutputClassesMap.getDirtyOutputClasses())
removeAllFromClassStorage(dirtyOutputClassesMap.getDirtyOutputClasses(), changesCollector)
dirtySources.clear()
dirtyOutputClassesMap.clean()
}
@@ -223,7 +223,7 @@ open class IncrementalJvmCache(
javaSourcesProtoMap.remove(it, changesCollector)
}
removeAllFromClassStorage(dirtyClasses.map { it.fqNameForClassNameWithoutDollars })
removeAllFromClassStorage(dirtyClasses.map { it.fqNameForClassNameWithoutDollars }, changesCollector)
dirtyOutputClassesMap.clean()
}
@@ -0,0 +1,33 @@
================ Step #1 =================
Compiling files:
src/B.kt
src/C.kt
src/createA.kt
src/createB.kt
src/createC.kt
src/useAfoo.kt
src/useBbar.kt
src/useCbaz.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
Unresolved reference: A
Unresolved reference: A
================ Step #2 =================
Compiling files:
src/B.kt
src/C.kt
src/createA.kt
src/createB.kt
src/createC.kt
src/funA.kt
src/useAfoo.kt
src/useBbar.kt
src/useCbaz.kt
End of files
Exit code: OK
@@ -0,0 +1,36 @@
================ Step #1 =================
Compiling files:
src/B.kt
src/createA.kt
src/createB.kt
src/useAfoo.kt
src/useBbar.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
Unresolved reference: A
Unresolved reference: A
================ Step #2 =================
Compiling files:
src/A.kt
src/B.kt
src/createA.kt
src/createB.kt
src/useAfoo.kt
src/useBbar.kt
End of files
Exit code: OK
================ Step #3 =================
Compiling files:
src/failCompilation.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
Expecting a top level declaration
@@ -34,6 +34,20 @@ Compiling files:
module2/src/createA.kt
module2/src/useAfoo.kt
End of files
Marked as dirty by Kotlin:
module2/src/createB.kt
module2/src/useBbar.kt
Exit code: ADDITIONAL_PASS_REQUIRED
------------------------------------------
Cleaning output files:
out/production/module2/META-INF/module2.kotlin_module
out/production/module2/use/CreateBKt.class
out/production/module2/use/UseBbarKt.class
End of files
Compiling files:
module2/src/createB.kt
module2/src/useBbar.kt
End of files
Exit code: OK
------------------------------------------