Use both target name and target type to get incremental cache from backend
Original commit: 0988b21e9c
This commit is contained in:
@@ -321,6 +321,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
|||||||
|| className.startsWith("org.apache.log4j.") // For logging from compiler
|
|| className.startsWith("org.apache.log4j.") // For logging from compiler
|
||||||
|| className == "org.jetbrains.kotlin.progress.CompilationCanceledStatus"
|
|| className == "org.jetbrains.kotlin.progress.CompilationCanceledStatus"
|
||||||
|| className == "org.jetbrains.kotlin.progress.CompilationCanceledException"
|
|| className == "org.jetbrains.kotlin.progress.CompilationCanceledException"
|
||||||
|
|| className == "org.jetbrains.kotlin.modules.Module"
|
||||||
},
|
},
|
||||||
compilerServices
|
compilerServices
|
||||||
)
|
)
|
||||||
|
|||||||
+30
-2
@@ -20,14 +20,42 @@ import org.jetbrains.jps.incremental.ModuleBuildTarget
|
|||||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
||||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
|
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
|
||||||
|
import org.jetbrains.kotlin.modules.Module
|
||||||
|
|
||||||
public class IncrementalCompilationComponentsImpl(
|
public class IncrementalCompilationComponentsImpl(
|
||||||
caches: Map<ModuleBuildTarget, IncrementalCache>,
|
caches: Map<ModuleBuildTarget, IncrementalCache>,
|
||||||
private val lookupTracker: LookupTracker
|
private val lookupTracker: LookupTracker
|
||||||
): IncrementalCompilationComponents {
|
): IncrementalCompilationComponents {
|
||||||
private val idToCache = caches.mapKeys { it.key.id!! }
|
private val caches = caches.mapKeys { ModuleToModuleBuildTargetAdapter(it.key) }
|
||||||
|
|
||||||
override fun getIncrementalCache(moduleId: String): IncrementalCache = idToCache[moduleId]!!
|
override fun getIncrementalCache(target: Module): IncrementalCache =
|
||||||
|
caches[target]!!
|
||||||
|
|
||||||
override fun getLookupTracker(): LookupTracker = lookupTracker
|
override fun getLookupTracker(): LookupTracker = lookupTracker
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ModuleToModuleBuildTargetAdapter(
|
||||||
|
private val moduleBuildTarget: ModuleBuildTarget
|
||||||
|
) : Module {
|
||||||
|
|
||||||
|
override fun getModuleName(): String =
|
||||||
|
moduleBuildTarget.id
|
||||||
|
|
||||||
|
override fun getModuleType(): String =
|
||||||
|
moduleBuildTarget.targetType.typeId
|
||||||
|
|
||||||
|
override fun getAnnotationsRoots(): List<String> =
|
||||||
|
throw UnsupportedOperationException()
|
||||||
|
|
||||||
|
override fun getClasspathRoots(): List<String> =
|
||||||
|
throw UnsupportedOperationException()
|
||||||
|
|
||||||
|
override fun getJavaSourceRoots(): List<String> =
|
||||||
|
throw UnsupportedOperationException()
|
||||||
|
|
||||||
|
override fun getOutputDirectory(): String =
|
||||||
|
throw UnsupportedOperationException()
|
||||||
|
|
||||||
|
override fun getSourceFiles(): List<String> =
|
||||||
|
throw UnsupportedOperationException()
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user