JPS: Fix initialization order for case when all kotlin rebuild.
#KT-27792 Fixed
This commit is contained in:
@@ -10,10 +10,9 @@ import org.jetbrains.jps.incremental.CompileContext
|
|||||||
import org.jetbrains.jps.incremental.FSOperations
|
import org.jetbrains.jps.incremental.FSOperations
|
||||||
import org.jetbrains.jps.incremental.GlobalContextKey
|
import org.jetbrains.jps.incremental.GlobalContextKey
|
||||||
import org.jetbrains.jps.incremental.fs.CompilationRound
|
import org.jetbrains.jps.incremental.fs.CompilationRound
|
||||||
|
import org.jetbrains.jps.incremental.messages.BuildMessage
|
||||||
|
import org.jetbrains.jps.incremental.messages.CompilerMessage
|
||||||
import org.jetbrains.kotlin.incremental.LookupSymbol
|
import org.jetbrains.kotlin.incremental.LookupSymbol
|
||||||
import org.jetbrains.kotlin.jps.incremental.CacheAttributesDiff
|
|
||||||
import org.jetbrains.kotlin.jps.incremental.CacheStatus
|
|
||||||
import org.jetbrains.kotlin.jps.incremental.loadDiff
|
|
||||||
import org.jetbrains.kotlin.jps.incremental.*
|
import org.jetbrains.kotlin.jps.incremental.*
|
||||||
import org.jetbrains.kotlin.jps.targets.KotlinTargetsIndex
|
import org.jetbrains.kotlin.jps.targets.KotlinTargetsIndex
|
||||||
import org.jetbrains.kotlin.jps.targets.KotlinTargetsIndexBuilder
|
import org.jetbrains.kotlin.jps.targets.KotlinTargetsIndexBuilder
|
||||||
@@ -61,8 +60,6 @@ class KotlinCompileContext(val jpsContext: CompileContext) {
|
|||||||
|
|
||||||
val lookupsCacheAttributesManager: CompositeLookupsCacheAttributesManager = makeLookupsCacheAttributesManager()
|
val lookupsCacheAttributesManager: CompositeLookupsCacheAttributesManager = makeLookupsCacheAttributesManager()
|
||||||
|
|
||||||
val initialLookupsCacheStateDiff: CacheAttributesDiff<*> = loadLookupsCacheStateDiff()
|
|
||||||
|
|
||||||
val shouldCheckCacheVersions = System.getProperty(KotlinBuilder.SKIP_CACHE_VERSION_CHECK_PROPERTY) == null
|
val shouldCheckCacheVersions = System.getProperty(KotlinBuilder.SKIP_CACHE_VERSION_CHECK_PROPERTY) == null
|
||||||
|
|
||||||
val hasKotlinMarker = HasKotlinMarker(dataManager)
|
val hasKotlinMarker = HasKotlinMarker(dataManager)
|
||||||
@@ -76,6 +73,12 @@ class KotlinCompileContext(val jpsContext: CompileContext) {
|
|||||||
|
|
||||||
var rebuildingAllKotlin = false
|
var rebuildingAllKotlin = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Note, [loadLookupsCacheStateDiff] should be initialized last as it requires initialized
|
||||||
|
* [targetsIndex], [hasKotlinMarker] and [rebuildAfterCacheVersionChanged] (see [markChunkForRebuildBeforeBuild])
|
||||||
|
*/
|
||||||
|
private val initialLookupsCacheStateDiff: CacheAttributesDiff<*> = loadLookupsCacheStateDiff()
|
||||||
|
|
||||||
private fun makeLookupsCacheAttributesManager(): CompositeLookupsCacheAttributesManager {
|
private fun makeLookupsCacheAttributesManager(): CompositeLookupsCacheAttributesManager {
|
||||||
val expectedLookupsCacheComponents = mutableSetOf<String>()
|
val expectedLookupsCacheComponents = mutableSetOf<String>()
|
||||||
|
|
||||||
@@ -102,7 +105,15 @@ class KotlinCompileContext(val jpsContext: CompileContext) {
|
|||||||
it.get(LookupSymbol("<#NAME#>", "<#SCOPE#>"))
|
it.get(LookupSymbol("<#NAME#>", "<#SCOPE#>"))
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
jpsReportInternalBuilderError(jpsContext, Error("Lookup storage is corrupted, probe failed: ${e.message}", e))
|
// replace to jpsReportInternalBuilderError when IDEA-201297 will be implemented
|
||||||
|
jpsContext.processMessage(
|
||||||
|
CompilerMessage(
|
||||||
|
"Kotlin", BuildMessage.Kind.WARNING,
|
||||||
|
"Incremental caches are corrupted. All Kotlin code will be rebuilt."
|
||||||
|
)
|
||||||
|
)
|
||||||
|
KotlinBuilder.LOG.info(Error("Lookup storage is corrupted, probe failed: ${e.message}", e))
|
||||||
|
|
||||||
markAllKotlinForRebuild("Lookup storage is corrupted")
|
markAllKotlinForRebuild("Lookup storage is corrupted")
|
||||||
return diff.copy(actual = null)
|
return diff.copy(actual = null)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user