Correctly processing disappeared protos, files with constants/inline function.
Original commit: c5593a5b80
This commit is contained in:
@@ -289,7 +289,10 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!compilationErrors) {
|
if (!compilationErrors) {
|
||||||
incrementalCaches.values().forEach { it.clearCacheForRemovedClasses() }
|
incrementalCaches.values().forEach {
|
||||||
|
val newDecision = it.clearCacheForRemovedClasses()
|
||||||
|
recompilationDecision = recompilationDecision.merge(newDecision)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return recompilationDecision
|
return recompilationDecision
|
||||||
|
|||||||
@@ -176,15 +176,26 @@ public class IncrementalCacheImpl(targetDataRoot: File) : StorageOwner, Incremen
|
|||||||
return DO_NOTHING
|
return DO_NOTHING
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun clearCacheForRemovedClasses() {
|
public fun clearCacheForRemovedClasses(): RecompilationDecision {
|
||||||
|
var recompilationDecision = DO_NOTHING
|
||||||
for (internalClassName in dirtyOutputClassesMap.getDirtyOutputClasses()) {
|
for (internalClassName in dirtyOutputClassesMap.getDirtyOutputClasses()) {
|
||||||
val className = JvmClassName.byInternalName(internalClassName)
|
val className = JvmClassName.byInternalName(internalClassName)
|
||||||
|
|
||||||
|
val newDecision = when {
|
||||||
|
internalClassName in inlineFunctionsMap -> RECOMPILE_ALL_CHUNK_AND_DEPENDANTS
|
||||||
|
internalClassName in constantsMap -> RECOMPILE_OTHERS_WITH_DEPENDANTS
|
||||||
|
internalClassName in protoMap -> RECOMPILE_OTHERS_IN_CHUNK
|
||||||
|
else -> DO_NOTHING
|
||||||
|
}
|
||||||
|
recompilationDecision = recompilationDecision.merge(newDecision)
|
||||||
|
|
||||||
protoMap.remove(className)
|
protoMap.remove(className)
|
||||||
packagePartMap.remove(className)
|
packagePartMap.remove(className)
|
||||||
constantsMap.remove(className)
|
constantsMap.remove(className)
|
||||||
inlineFunctionsMap.remove(className)
|
inlineFunctionsMap.remove(className)
|
||||||
}
|
}
|
||||||
dirtyOutputClassesMap.clear()
|
dirtyOutputClassesMap.clear()
|
||||||
|
return recompilationDecision
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun getObsoletePackageParts(): Collection<String> {
|
public override fun getObsoletePackageParts(): Collection<String> {
|
||||||
@@ -213,6 +224,8 @@ public class IncrementalCacheImpl(targetDataRoot: File) : StorageOwner, Incremen
|
|||||||
|
|
||||||
protected abstract fun createMap(): PersistentHashMap<String, V>
|
protected abstract fun createMap(): PersistentHashMap<String, V>
|
||||||
|
|
||||||
|
public fun contains(key: String): Boolean = storage.containsMapping(key)
|
||||||
|
|
||||||
public fun clean() {
|
public fun clean() {
|
||||||
try {
|
try {
|
||||||
storage.close()
|
storage.close()
|
||||||
|
|||||||
@@ -225,6 +225,18 @@ public class IncrementalJpsTestGenerated extends AbstractIncrementalJpsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("fileWithConstantRemoved")
|
||||||
|
public void testFileWithConstantRemoved() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/incremental/pureKotlin/fileWithConstantRemoved/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("fileWithInlineFunctionRemoved")
|
||||||
|
public void testFileWithInlineFunctionRemoved() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/incremental/pureKotlin/fileWithInlineFunctionRemoved/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("filesExchangePackages")
|
@TestMetadata("filesExchangePackages")
|
||||||
public void testFilesExchangePackages() throws Exception {
|
public void testFilesExchangePackages() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/incremental/pureKotlin/filesExchangePackages/");
|
String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/incremental/pureKotlin/filesExchangePackages/");
|
||||||
|
|||||||
@@ -3,6 +3,13 @@ out/production/module/test/A.class
|
|||||||
End of files
|
End of files
|
||||||
Compiling files:
|
Compiling files:
|
||||||
End of files
|
End of files
|
||||||
|
Cleaning output files:
|
||||||
|
out/production/module/test/TestPackage$other$*.class
|
||||||
|
out/production/module/test/TestPackage.class
|
||||||
|
End of files
|
||||||
|
Compiling files:
|
||||||
|
src/other.kt
|
||||||
|
End of files
|
||||||
|
|
||||||
|
|
||||||
Compiling files:
|
Compiling files:
|
||||||
@@ -14,4 +21,4 @@ out/production/module/test/TestPackage.class
|
|||||||
End of files
|
End of files
|
||||||
Compiling files:
|
Compiling files:
|
||||||
src/other.kt
|
src/other.kt
|
||||||
End of files
|
End of files
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
Cleaning output files:
|
||||||
|
out/production/module/test/TestPackage$const$*.class
|
||||||
|
out/production/module/test/TestPackage.class
|
||||||
|
End of files
|
||||||
|
Compiling files:
|
||||||
|
End of files
|
||||||
|
Cleaning output files:
|
||||||
|
out/production/module/usage/UsagePackage$usage$*.class
|
||||||
|
out/production/module/usage/UsagePackage.class
|
||||||
|
End of files
|
||||||
|
Compiling files:
|
||||||
|
src/usage.kt
|
||||||
|
End of files
|
||||||
|
COMPILATION FAILED
|
||||||
|
Unresolved reference: test
|
||||||
|
An annotation parameter must be a compile-time constant
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
val CONST = "foo"
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package usage
|
||||||
|
|
||||||
|
deprecated(test.CONST)
|
||||||
|
val usage = ""
|
||||||
|
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
Cleaning output files:
|
||||||
|
out/production/module/inline/InlinePackage$inline$*.class
|
||||||
|
out/production/module/inline/InlinePackage.class
|
||||||
|
End of files
|
||||||
|
Compiling files:
|
||||||
|
End of files
|
||||||
|
Cleaning output files:
|
||||||
|
out/production/module/usage/UsagePackage$usage$*.class
|
||||||
|
out/production/module/usage/UsagePackage.class
|
||||||
|
End of files
|
||||||
|
Compiling files:
|
||||||
|
src/usage.kt
|
||||||
|
End of files
|
||||||
|
COMPILATION FAILED
|
||||||
|
Unresolved reference: f
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package inline
|
||||||
|
|
||||||
|
inline fun f(body: () -> Unit) {
|
||||||
|
println("i'm inline function")
|
||||||
|
body()
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package usage
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
inline.f {
|
||||||
|
println("to be inlined")
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user