Revert "[K2/N] KT-57026, KT-57208: Adjust Native & JS test infrastructures for MPP testing"
This reverts commit 6964121c15.
This commit is contained in:
@@ -81,7 +81,7 @@ fun compileModuleToAnalyzedFir(
|
||||
val resolvedLibraries = moduleStructure.fullResolvedLibraries
|
||||
|
||||
val sessionsWithSources = prepareJsSessions(
|
||||
ktFiles, moduleStructure.compilerConfiguration, escapedMainModuleName,
|
||||
ktFiles, moduleStructure.compilerConfiguration, escapedMainModuleName.asString(),
|
||||
resolvedLibraries, dependencyList, extensionRegistrars, isCommonSourceForPsi, fileBelongsToModuleForPsi
|
||||
)
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
+1
-2
@@ -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
|
||||
)
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND_K1: ANY
|
||||
// IGNORE_BACKEND_MULTI_MODULE: ANY
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// WITH_STDLIB
|
||||
// IGNORE_BACKEND_K1: ANY
|
||||
// IGNORE_BACKEND_K2: NATIVE
|
||||
|
||||
// MODULE: common
|
||||
// FILE: common.kt
|
||||
|
||||
+2
-4
@@ -1,10 +1,8 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// !OPT_IN: kotlin.ExperimentalMultiplatform
|
||||
// IGNORE_BACKEND: WASM
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE
|
||||
// IGNORE_BACKEND: NATIVE, WASM
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
// IGNORE_BACKEND_K2: JS_IR
|
||||
// KT-57181
|
||||
// IGNORE_BACKEND_K2: NATIVE
|
||||
// WITH_STDLIB
|
||||
|
||||
// MODULE: common
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
|
||||
// MODULE: common
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
|
||||
// MODULE: common
|
||||
// FILE: common.kt
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
|
||||
// MODULE: common
|
||||
// FILE: common.kt
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
// WITH_STDLIB
|
||||
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
|
||||
// MODULE: common
|
||||
|
||||
+2
-4
@@ -1,7 +1,5 @@
|
||||
// IGNORE_BACKEND: JS_IR, JS_IR_ES6, WASM
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, NATIVE
|
||||
// KT-57181
|
||||
// IGNORE_BACKEND_K2: NATIVE
|
||||
// IGNORE_BACKEND: JS_IR, JS_IR_ES6, NATIVE, WASM
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS
|
||||
// WASM_MUTE_REASON: EXPECT_DEFAULT_PARAMETERS
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// ISSUE: KT-41901
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
|
||||
// MODULE: common
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
// WITH_STDLIB
|
||||
|
||||
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE
|
||||
// KT-57181
|
||||
// IGNORE_BACKEND_K2: NATIVE
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
// WITH_STDLIB
|
||||
|
||||
// MODULE: common
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
// WITH_STDLIB
|
||||
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
// WITH_STDLIB
|
||||
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
|
||||
// MODULE: common
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
// WITH_STDLIB
|
||||
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
// WITH_STDLIB
|
||||
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
|
||||
// MODULE: common
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
// WITH_STDLIB
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
// WITH_STDLIB
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
|
||||
// MODULE: common
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
|
||||
// MODULE: common
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
// WITH_STDLIB
|
||||
// WITH_COROUTINES
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
// WITH_STDLIB
|
||||
|
||||
|
||||
+2
-4
@@ -1,9 +1,7 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: WASM
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE
|
||||
// IGNORE_BACKEND: NATIVE, WASM
|
||||
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6
|
||||
// IGNORE_BACKEND_K2: JS_IR
|
||||
// KT-57181
|
||||
// IGNORE_BACKEND_K2: NATIVE
|
||||
// WITH_STDLIB
|
||||
|
||||
// MODULE: common
|
||||
|
||||
+1
-3
@@ -4,7 +4,6 @@
|
||||
*/
|
||||
package org.jetbrains.kotlin.checkers
|
||||
|
||||
import org.jetbrains.kotlin.ObsoleteTestInfrastructure
|
||||
import org.jetbrains.kotlin.cli.common.config.addKotlinSourceRoot
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
@@ -119,7 +118,6 @@ abstract class KotlinMultiFileTestWithJava<M : KotlinBaseTest.TestModule, F : Ko
|
||||
|
||||
protected abstract fun createTestFile(module: M?, fileName: String, text: String, directives: Directives): F
|
||||
|
||||
@OptIn(ObsoleteTestInfrastructure::class)
|
||||
protected open fun createTestFiles(
|
||||
file: File,
|
||||
expectedText: String,
|
||||
@@ -141,7 +139,7 @@ abstract class KotlinMultiFileTestWithJava<M : KotlinBaseTest.TestModule, F : Ko
|
||||
return createTestFile(module, fileName, text, directives)
|
||||
}
|
||||
|
||||
override fun createModule(name: String, dependencies: List<String>, friends: List<String>, dependsOn: List<String>): M? {
|
||||
override fun createModule(name: String, dependencies: List<String>, friends: List<String>, abiVersions: List<Int>): M? {
|
||||
val module = createTestModule(name, dependencies, friends)
|
||||
val oldValue = modules.put(name, ModuleAndDependencies(module, dependencies, friends))
|
||||
assert(oldValue == null) { "Module $name declared more than once" }
|
||||
|
||||
+1
-3
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.compatibility.binary
|
||||
|
||||
import org.jetbrains.kotlin.ObsoleteTestInfrastructure
|
||||
import org.jetbrains.kotlin.test.*
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import org.jetbrains.kotlin.utils.DFS
|
||||
@@ -72,7 +71,6 @@ abstract class AbstractKlibBinaryCompatibilityTest : KotlinTestWithEnvironment()
|
||||
const val TEST_FUNCTION = "box"
|
||||
const val DEFAULT_MODULE = "main"
|
||||
|
||||
@OptIn(ObsoleteTestInfrastructure::class)
|
||||
fun doTest(
|
||||
filePath: String,
|
||||
expectedResult: String,
|
||||
@@ -91,7 +89,7 @@ abstract class AbstractKlibBinaryCompatibilityTest : KotlinTestWithEnvironment()
|
||||
TestFile(module, fileName, text, directives)
|
||||
} ?: error("Expected a module for $fileName in $filePath")
|
||||
|
||||
override fun createModule(name: String, dependencies: List<String>, friends: List<String>, dependsOn: List<String>) =
|
||||
override fun createModule(name: String, dependencies: List<String>, friends: List<String>, abiVersions: List<Int>) =
|
||||
TestModule(name, dependencies, friends)
|
||||
|
||||
},
|
||||
|
||||
@@ -108,13 +108,11 @@ abstract class KotlinBaseTest<F : KotlinBaseTest.TestFile> : KtUsefulTestCase()
|
||||
open class TestModule(
|
||||
@JvmField val name: String,
|
||||
@JvmField val dependenciesSymbols: List<String>,
|
||||
@JvmField val friendsSymbols: List<String>,
|
||||
@JvmField val dependsOnSymbols: List<String> = listOf(), // mimics the name from ModuleStructureExtractorImpl, thought later converted to `-Xfragment-refines` parameter
|
||||
@JvmField val friendsSymbols: List<String>
|
||||
) : Comparable<TestModule> {
|
||||
|
||||
val dependencies: MutableList<TestModule> = arrayListOf()
|
||||
val friends: MutableList<TestModule> = arrayListOf()
|
||||
val dependsOn: MutableList<TestModule> = arrayListOf()
|
||||
|
||||
override fun compareTo(other: TestModule): Int = name.compareTo(other.name)
|
||||
|
||||
|
||||
@@ -6,10 +6,8 @@
|
||||
package org.jetbrains.kotlin.test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import kotlin.text.StringsKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.ObsoleteTestInfrastructure;
|
||||
import org.jetbrains.kotlin.TestHelperGeneratorKt;
|
||||
|
||||
import java.util.*;
|
||||
@@ -20,12 +18,11 @@ import java.util.stream.Collectors;
|
||||
import static org.jetbrains.kotlin.test.InTextDirectivesUtils.isDirectiveDefined;
|
||||
import static org.jetbrains.kotlin.test.KotlinTestUtils.parseDirectives;
|
||||
|
||||
@ObsoleteTestInfrastructure // THIS TEST PARSER IS OUTDATED/DEPRECATED. PLEASE USE ModuleStructureExtractor INSTEAD
|
||||
public class TestFiles {
|
||||
/**
|
||||
* Syntax:
|
||||
*
|
||||
* // MODULE: name(dependency1, dependency2, ...)(friend1, friend2, ...)(dependsOn1, dependsOn2, ...)
|
||||
* // MODULE: name(dependency1, dependency2, ...)
|
||||
*
|
||||
* // FILE: name
|
||||
*
|
||||
@@ -33,11 +30,7 @@ public class TestFiles {
|
||||
*/
|
||||
private static final String MODULE_DELIMITER = ",\\s*";
|
||||
|
||||
private static final Pattern MODULE_PREFIX_PATTERN = Pattern.compile("//\\s*MODULE:.*\n");
|
||||
private static final Pattern MODULE_PATTERN = Pattern.compile("//\\s*MODULE:\\s*([^()\\n]+)" + // name
|
||||
"(?:\\(([^()]*(?:" + MODULE_DELIMITER + "[^()]+)*)\\))?\\s*" + // dependencies
|
||||
"(?:\\(([^()]*(?:" + MODULE_DELIMITER + "[^()]+)*)\\))?\\s*" + // friends
|
||||
"(?:\\(([^()]*(?:" + MODULE_DELIMITER + "[^()]+)*)\\))?\n"); // dependsOn
|
||||
private static final Pattern MODULE_PATTERN = Pattern.compile("//\\s*MODULE:\\s*([^()\\n]+)(?:\\(([^()]+(?:" + MODULE_DELIMITER + "[^()]+)*)\\))?\\s*(?:\\(([^()]+(?:" + MODULE_DELIMITER + "[^()]+)*)\\))?\\s*(?:\\((\\d+(?:" + MODULE_DELIMITER + "\\d+)*)\\))?\n");
|
||||
private static final Pattern FILE_PATTERN = Pattern.compile("//\\s*FILE:\\s*(.*)\n");
|
||||
|
||||
private static final Pattern LINE_SEPARATOR_PATTERN = Pattern.compile("\\r\\n|\\r|\\n");
|
||||
@@ -60,15 +53,11 @@ public class TestFiles {
|
||||
List<F> testFiles = Lists.newArrayList();
|
||||
Matcher fileMatcher = FILE_PATTERN.matcher(expectedText);
|
||||
Matcher moduleMatcher = MODULE_PATTERN.matcher(expectedText);
|
||||
Matcher modulePrefixMatcher = MODULE_PREFIX_PATTERN.matcher(expectedText);
|
||||
boolean hasModules = false;
|
||||
String commonPrefixOrWholeFile;
|
||||
|
||||
boolean fileFound = fileMatcher.find();
|
||||
boolean moduleFound = moduleMatcher.find();
|
||||
boolean modulePrefixFound = modulePrefixMatcher.find();
|
||||
assert moduleFound == modulePrefixFound : "First MODULE directive doesn't match to the expected pattern in:\n" + expectedText;
|
||||
|
||||
if (!fileFound && !moduleFound) {
|
||||
assert testFileName != null : "testFileName should not be null if no FILE directive defined";
|
||||
// One file
|
||||
@@ -96,20 +85,17 @@ public class TestFiles {
|
||||
String moduleName = moduleMatcher.group(1);
|
||||
String moduleDependencies = moduleMatcher.group(2);
|
||||
String moduleFriends = moduleMatcher.group(3);
|
||||
String moduleDependsOn = moduleMatcher.group(4);
|
||||
String abiVersions = moduleMatcher.group(4);
|
||||
if (moduleName != null) {
|
||||
moduleName = moduleName.trim();
|
||||
hasModules = true;
|
||||
module = factory.createModule(moduleName, parseModuleList(moduleDependencies), parseModuleList(moduleFriends), parseModuleList(moduleDependsOn));
|
||||
module = factory.createModule(moduleName, parseModuleList(moduleDependencies), parseModuleList(moduleFriends), parseAbiVersionsList(abiVersions));
|
||||
M oldValue = modules.put(moduleName, module);
|
||||
assert oldValue == null : "Module with name " + moduleName + " already present in file";
|
||||
}
|
||||
}
|
||||
|
||||
boolean nextModuleExists = moduleMatcher.find();
|
||||
boolean nextModulePrefixExists = modulePrefixMatcher.find();
|
||||
assert nextModuleExists == nextModulePrefixExists : "Continuation MODULE directive doesn't match to the expected pattern in:\n" + expectedText;
|
||||
|
||||
moduleFound = nextModuleExists;
|
||||
while (true) {
|
||||
String fileName = fileMatcher.group(1);
|
||||
@@ -170,26 +156,19 @@ public class TestFiles {
|
||||
|
||||
for (M module : modules.values()) {
|
||||
if (module != null) {
|
||||
module.getDependencies().addAll(module.dependenciesSymbols.stream().map(name -> {
|
||||
M dep = modules.get(name);
|
||||
assert dep != null : "Dependency not found: " + name + " for module " + module.name + " in:\n" + expectedText;
|
||||
return dep;
|
||||
}).collect(Collectors.toList()));
|
||||
module.getDependencies().addAll(module.dependenciesSymbols.stream()
|
||||
.map(modules::get)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
module.getFriends().addAll(module.friendsSymbols.stream().map(name -> {
|
||||
M dep = modules.get(name);
|
||||
assert dep != null : "Dependency not found: " + name + " for module " + module.name + " in:\n" + expectedText;
|
||||
return dep;
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
module.getDependsOn().addAll(module.dependsOnSymbols.stream().map(name -> {
|
||||
M dep = modules.get(name);
|
||||
assert dep != null : "Dependency not found: " + name + " for module " + module.name + " in:\n" + expectedText;
|
||||
return dep;
|
||||
}).collect(Collectors.toList()));
|
||||
module.getFriends().addAll(module.friendsSymbols.stream()
|
||||
.map(modules::get)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return testFiles;
|
||||
}
|
||||
|
||||
@@ -214,13 +193,23 @@ public class TestFiles {
|
||||
}
|
||||
|
||||
private static List<String> parseModuleList(@Nullable String dependencies) {
|
||||
if (dependencies == null || StringsKt.isBlank(dependencies)) return Collections.emptyList();
|
||||
return StringsKt.split(dependencies, Pattern.compile(MODULE_DELIMITER), 0);
|
||||
if (dependencies == null) return Collections.emptyList();
|
||||
return kotlin.text.StringsKt.split(dependencies, Pattern.compile(MODULE_DELIMITER), 0);
|
||||
}
|
||||
|
||||
private static List<Integer> parseAbiVersionsList(@Nullable String versions) {
|
||||
if (versions == null) return Collections.emptyList();
|
||||
List<String> splitted = kotlin.text.StringsKt.split(versions, Pattern.compile(MODULE_DELIMITER), 0);
|
||||
List<Integer> result = new ArrayList<>(splitted.size());
|
||||
for (String s : splitted) {
|
||||
result.add(Integer.parseInt(s));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public interface TestFileFactory<M, F> {
|
||||
F createFile(@Nullable M module, @NotNull String fileName, @NotNull String text, @NotNull Directives directives);
|
||||
M createModule(@NotNull String name, @NotNull List<String> dependencies, @NotNull List<String> friends, @NotNull List<String> dependsOn);
|
||||
M createModule(@NotNull String name, @NotNull List<String> dependencies, @NotNull List<String> friends, @NotNull List<Integer> abiVersions);
|
||||
}
|
||||
|
||||
public static abstract class TestFileFactoryNoModules<F> implements TestFileFactory<KotlinBaseTest.TestModule, F> {
|
||||
@@ -238,7 +227,7 @@ public class TestFiles {
|
||||
public abstract F create(@NotNull String fileName, @NotNull String text, @NotNull Directives directives);
|
||||
|
||||
@Override
|
||||
public KotlinBaseTest.TestModule createModule(@NotNull String name, @NotNull List<String> dependencies, @NotNull List<String> friends, @NotNull List<String> dependsOn) {
|
||||
public KotlinBaseTest.TestModule createModule(@NotNull String name, @NotNull List<String> dependencies, @NotNull List<String> friends, @NotNull List<Integer> abiVersions) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user