Revert "[K2/N] KT-57026, KT-57208: Adjust Native & JS test infrastructures for MPP testing"

This reverts commit 6964121c15.
This commit is contained in:
Nikolay Krasko
2023-03-10 11:58:03 +01:00
committed by teamcity
parent aed6272107
commit c0c692844e
51 changed files with 106 additions and 187 deletions
@@ -55,7 +55,7 @@ fun <F> prepareJvmSessions(
files: List<F>,
configuration: CompilerConfiguration,
projectEnvironment: AbstractProjectEnvironment,
rootModuleName: Name,
rootModuleName: String,
extensionRegistrars: List<FirExtensionRegistrar>,
librariesScope: AbstractProjectFileSearchScope,
libraryList: DependencyListForCliModule,
@@ -70,7 +70,7 @@ fun <F> prepareJvmSessions(
JvmPlatformAnalyzerServices, libraryList, isCommonSource, fileBelongsToModule,
createLibrarySession = { sessionProvider ->
FirJvmSessionFactory.createLibrarySession(
rootModuleName,
Name.identifier(rootModuleName),
sessionProvider,
libraryList.moduleDataProvider,
projectEnvironment,
@@ -109,7 +109,7 @@ fun <F> prepareJvmSessions(
fun <F> prepareJsSessions(
files: List<F>,
configuration: CompilerConfiguration,
rootModuleName: Name,
rootModuleName: String,
resolvedLibraries: List<KotlinResolvedLibrary>,
libraryList: DependencyListForCliModule,
extensionRegistrars: List<FirExtensionRegistrar>,
@@ -121,7 +121,7 @@ fun <F> prepareJsSessions(
libraryList, isCommonSource, fileBelongsToModule,
createLibrarySession = { sessionProvider ->
FirJsSessionFactory.createLibrarySession(
rootModuleName,
Name.identifier(rootModuleName),
resolvedLibraries,
sessionProvider,
libraryList.moduleDataProvider,
@@ -152,7 +152,7 @@ fun <F> prepareJsSessions(
fun <F> prepareNativeSessions(
files: List<F>,
configuration: CompilerConfiguration,
rootModuleName: Name,
rootModuleName: String,
resolvedLibraries: List<KotlinResolvedLibrary>,
libraryList: DependencyListForCliModule,
extensionRegistrars: List<FirExtensionRegistrar>,
@@ -163,7 +163,7 @@ fun <F> prepareNativeSessions(
files, configuration, rootModuleName, NativePlatforms.unspecifiedNativePlatform, NativePlatformAnalyzerServices,
libraryList, isCommonSource, fileBelongsToModule, createLibrarySession = { sessionProvider ->
FirNativeSessionFactory.createLibrarySession(
rootModuleName,
Name.identifier(rootModuleName),
resolvedLibraries,
sessionProvider,
libraryList.moduleDataProvider,
@@ -193,7 +193,7 @@ fun <F> prepareCommonSessions(
files: List<F>,
configuration: CompilerConfiguration,
projectEnvironment: AbstractProjectEnvironment,
rootModuleName: Name,
rootModuleName: String,
extensionRegistrars: List<FirExtensionRegistrar>,
librariesScope: AbstractProjectFileSearchScope,
libraryList: DependencyListForCliModule,
@@ -206,7 +206,7 @@ fun <F> prepareCommonSessions(
files, configuration, rootModuleName, CommonPlatforms.defaultCommonPlatform, CommonPlatformAnalyzerServices,
libraryList, isCommonSource, fileBelongsToModule, createLibrarySession = { sessionProvider ->
FirCommonSessionFactory.createLibrarySession(
rootModuleName,
Name.identifier(rootModuleName),
sessionProvider,
libraryList.moduleDataProvider,
projectEnvironment,
@@ -240,7 +240,7 @@ private typealias FirSessionProducer<F> = (List<F>, FirModuleData, FirProjectSes
private inline fun <F> prepareSessions(
files: List<F>,
configuration: CompilerConfiguration,
rootModuleName: Name,
rootModuleName: String,
targetPlatform: TargetPlatform,
analyzerServices: PlatformDependentAnalyzerServices,
libraryList: DependencyListForCliModule,
@@ -277,7 +277,7 @@ private inline fun <F> prepareSessions(
)
else -> createSessionsForHmppProject(
files, rootModuleName, hmppModuleStructure, libraryList, targetPlatform, analyzerServices,
files, hmppModuleStructure, libraryList, targetPlatform, analyzerServices,
sessionProvider, sessionConfigurator, fileBelongsToModule, createSourceSession
)
}
@@ -285,7 +285,7 @@ private inline fun <F> prepareSessions(
private inline fun <F> createSessionForNonMppProject(
files: List<F>,
rootModuleName: Name,
rootModuleName: String,
libraryList: DependencyListForCliModule,
targetPlatform: TargetPlatform,
analyzerServices: PlatformDependentAnalyzerServices,
@@ -294,7 +294,7 @@ private inline fun <F> createSessionForNonMppProject(
createFirSession: FirSessionProducer<F>,
): SessionWithSources<F> {
val platformModuleData = FirModuleDataImpl(
rootModuleName,
Name.identifier(rootModuleName),
libraryList.regularDependencies,
dependsOnDependencies = emptyList(),
libraryList.friendsDependencies,
@@ -308,7 +308,7 @@ private inline fun <F> createSessionForNonMppProject(
private inline fun <F> createSessionsForLegacyMppProject(
files: List<F>,
rootModuleName: Name,
rootModuleName: String,
libraryList: DependencyListForCliModule,
targetPlatform: TargetPlatform,
analyzerServices: PlatformDependentAnalyzerServices,
@@ -318,7 +318,7 @@ private inline fun <F> createSessionsForLegacyMppProject(
createFirSession: FirSessionProducer<F>,
): List<SessionWithSources<F>> {
val commonModuleData = FirModuleDataImpl(
Name.identifier("${rootModuleName.asString()}-common"),
Name.identifier("${rootModuleName}-common"),
libraryList.regularDependencies,
listOf(),
libraryList.friendsDependencies,
@@ -327,7 +327,7 @@ private inline fun <F> createSessionsForLegacyMppProject(
)
val platformModuleData = FirModuleDataImpl(
rootModuleName,
Name.identifier(rootModuleName),
libraryList.regularDependencies,
listOf(commonModuleData),
libraryList.friendsDependencies,
@@ -352,7 +352,6 @@ private inline fun <F> createSessionsForLegacyMppProject(
private inline fun <F> createSessionsForHmppProject(
files: List<F>,
rootModuleName: Name,
hmppModuleStructure: HmppCliModuleStructure,
libraryList: DependencyListForCliModule,
targetPlatform: TargetPlatform,
@@ -369,7 +368,7 @@ private inline fun <F> createSessionsForHmppProject(
?.map { moduleDataForHmppModule.getValue(it) }
.orEmpty()
val moduleData = FirModuleDataImpl(
rootModuleName,
Name.identifier(module.name),
libraryList.regularDependencies,
dependsOnDependencies = dependencies,
libraryList.friendsDependencies,
@@ -44,7 +44,6 @@ import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompil
import org.jetbrains.kotlin.modules.Module
import org.jetbrains.kotlin.modules.TargetId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.multiplatform.hmppModuleName
@@ -201,7 +200,7 @@ object FirKotlinToJvmBytecodeCompiler {
val rootModuleName = module.getModuleName()
val libraryList = createLibraryListForJvm(rootModuleName, moduleConfiguration, module.getFriendPaths())
val sessionsWithSources = prepareJvmSessions(
ktFiles, moduleConfiguration, projectEnvironment, Name.identifier(rootModuleName),
ktFiles, moduleConfiguration, projectEnvironment, rootModuleName,
extensionRegistrars, librariesScope, libraryList,
isCommonSource = { it.isCommonSource == true },
fileBelongsToModule = { file, moduleName -> file.hmppModuleName == moduleName },
@@ -65,7 +65,6 @@ import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackagePartProvid
import org.jetbrains.kotlin.modules.Module
import org.jetbrains.kotlin.modules.TargetId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.platform.CommonPlatforms
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus
@@ -327,7 +326,7 @@ fun compileModuleToAnalyzedFir(
// TODO: handle friends paths
val libraryList = createLibraryListForJvm(rootModuleName, moduleConfiguration, friendPaths = emptyList())
val sessionWithSources = prepareJvmSessions(
allSources, moduleConfiguration, projectEnvironment, Name.identifier(rootModuleName),
allSources, moduleConfiguration, projectEnvironment, rootModuleName,
extensionRegistrars, librariesScope, libraryList,
isCommonSource = input.groupedSources.isCommonSourceForLt,
fileBelongsToModule = input.groupedSources.fileBelongsToModuleForLt,
@@ -57,11 +57,12 @@ internal class FirMetadataSerializer(
val configuration = environment.configuration
val messageCollector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
val rootModuleName = Name.special("<${configuration.getNotNull(CommonConfigurationKeys.MODULE_NAME)}>")
val moduleName = Name.special("<${configuration.getNotNull(CommonConfigurationKeys.MODULE_NAME)}>")
val isLightTree = configuration.getBoolean(CommonConfigurationKeys.USE_LIGHT_TREE)
val rootModuleName = moduleName.asString()
val binaryModuleData = BinaryModuleData.initialize(
rootModuleName,
Name.identifier(rootModuleName),
CommonPlatforms.defaultCommonPlatform,
CommonPlatformAnalyzerServices
)