[FIR] Cleanup IC provider creation in FirSessionFactory
This commit is contained in:
committed by
TeamCityServer
parent
6d38a236c1
commit
6e4cc49f1d
+10
-8
@@ -90,6 +90,15 @@ object FirKotlinToJvmBytecodeCompiler {
|
||||
|
||||
val librariesScope = ProjectScope.getLibrariesScope(project)
|
||||
|
||||
val providerAndScopeForIncrementalCompilation = run {
|
||||
if (targetIds == null || incrementalComponents == null) return@run null
|
||||
val packagePartProvider = IncrementalPackagePartProvider(
|
||||
environment.createPackagePartProvider(sourceScope),
|
||||
targetIds.map(incrementalComponents::getIncrementalCache)
|
||||
)
|
||||
FirSessionFactory.ProviderAndScopeForIncrementalCompilation(packagePartProvider, librariesScope)
|
||||
}
|
||||
|
||||
val languageVersionSettings = moduleConfiguration.languageVersionSettings
|
||||
val session = createSessionWithDependencies(
|
||||
Name.identifier(module.getModuleName()),
|
||||
@@ -101,15 +110,8 @@ object FirKotlinToJvmBytecodeCompiler {
|
||||
sourceScope,
|
||||
librariesScope,
|
||||
lookupTracker = environment.configuration.get(CommonConfigurationKeys.LOOKUP_TRACKER),
|
||||
providerAndScopeForIncrementalCompilation,
|
||||
getPackagePartProvider = { environment.createPackagePartProvider(it) },
|
||||
getProviderAndScopeForIncrementalCompilation = get@{
|
||||
if (targetIds == null || incrementalComponents == null) return@get null
|
||||
val packagePartProvider = IncrementalPackagePartProvider(
|
||||
environment.createPackagePartProvider(sourceScope),
|
||||
targetIds.map(incrementalComponents::getIncrementalCache)
|
||||
)
|
||||
FirSessionFactory.ProviderAndScopeForIncrementalCompilation(packagePartProvider, librariesScope)
|
||||
},
|
||||
dependenciesConfigurator = {
|
||||
dependencies(moduleConfiguration.jvmClasspathRoots.map { it.toPath() })
|
||||
friendDependencies(moduleConfiguration[JVMConfigurationKeys.FRIEND_PATHS] ?: emptyList())
|
||||
|
||||
@@ -84,8 +84,8 @@ object FirSessionFactory {
|
||||
sourceScope: GlobalSearchScope,
|
||||
librariesScope: GlobalSearchScope,
|
||||
lookupTracker: LookupTracker?,
|
||||
providerAndScopeForIncrementalCompilation: ProviderAndScopeForIncrementalCompilation?,
|
||||
getPackagePartProvider: (GlobalSearchScope) -> PackagePartProvider,
|
||||
getProviderAndScopeForIncrementalCompilation: () -> ProviderAndScopeForIncrementalCompilation?,
|
||||
dependenciesConfigurator: DependencyListForCliModule.Builder.() -> Unit = {},
|
||||
noinline sessionConfigurator: FirSessionConfigurator.() -> Unit = {},
|
||||
): FirSession {
|
||||
@@ -113,7 +113,7 @@ object FirSessionFactory {
|
||||
sessionProvider,
|
||||
sourceScope,
|
||||
project,
|
||||
providerAndScopeForIncrementalCompilation = getProviderAndScopeForIncrementalCompilation(),
|
||||
providerAndScopeForIncrementalCompilation,
|
||||
languageVersionSettings = languageVersionSettings,
|
||||
lookupTracker = lookupTracker,
|
||||
init = sessionConfigurator
|
||||
|
||||
+1
-1
@@ -76,8 +76,8 @@ class FirFrontendFacade(
|
||||
sourcesScope,
|
||||
librariesScope,
|
||||
lookupTracker = null,
|
||||
providerAndScopeForIncrementalCompilation = null,
|
||||
getPackagePartProvider = packagePartProviderFactory,
|
||||
getProviderAndScopeForIncrementalCompilation = { null },
|
||||
dependenciesConfigurator = {
|
||||
dependencies(configuration.jvmModularRoots.map { it.toPath() })
|
||||
dependencies(configuration.jvmClasspathRoots.map { it.toPath() })
|
||||
|
||||
+1
-1
@@ -90,8 +90,8 @@ abstract class AbstractFirBaseDiagnosticsTest : BaseDiagnosticsTest() {
|
||||
sourceScope = scope,
|
||||
librariesScope = allProjectScope,
|
||||
lookupTracker = null,
|
||||
providerAndScopeForIncrementalCompilation = null,
|
||||
getPackagePartProvider = { environment.createPackagePartProvider(it) },
|
||||
getProviderAndScopeForIncrementalCompilation = { null },
|
||||
) {
|
||||
configureSession()
|
||||
getFirExtensions()?.let {
|
||||
|
||||
@@ -52,8 +52,8 @@ fun createSessionForTests(
|
||||
sourceScope,
|
||||
librariesScope,
|
||||
lookupTracker = null,
|
||||
providerAndScopeForIncrementalCompilation = null,
|
||||
getPackagePartProvider,
|
||||
getProviderAndScopeForIncrementalCompilation = { null },
|
||||
dependenciesConfigurator = {
|
||||
friendDependencies(friendsPaths)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user