diff --git a/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/model/Modules.kt b/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/model/Modules.kt index 0996531b75b..f040006446d 100644 --- a/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/model/Modules.kt +++ b/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/model/Modules.kt @@ -16,6 +16,7 @@ data class TestModule( val targetPlatform: TargetPlatform, val targetBackend: TargetBackend?, val frontendKind: FrontendKind<*>, + val binaryKind: BinaryKind<*>, val files: List, val dependencies: List, val friends: List, diff --git a/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/services/DefaultsProvider.kt b/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/services/DefaultsProvider.kt index 54310fdb033..9b1988dd582 100644 --- a/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/services/DefaultsProvider.kt +++ b/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/services/DefaultsProvider.kt @@ -9,8 +9,10 @@ import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.platform.TargetPlatform import org.jetbrains.kotlin.test.TargetBackend import org.jetbrains.kotlin.test.builders.LanguageVersionSettingsBuilder +import org.jetbrains.kotlin.test.model.BinaryKind import org.jetbrains.kotlin.test.model.DependencyKind import org.jetbrains.kotlin.test.model.FrontendKind +import org.jetbrains.kotlin.test.model.TestArtifactKind /* * TODO: @@ -22,6 +24,7 @@ class DefaultsProvider( val defaultLanguageSettings: LanguageVersionSettings, private val defaultLanguageSettingsBuilder: LanguageVersionSettingsBuilder, val defaultPlatform: TargetPlatform, + val defaultArtifactKind: BinaryKind<*>?, val defaultTargetBackend: TargetBackend?, val defaultDependencyKind: DependencyKind ) : TestService { diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/builders/DefaultsProviderBuilder.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/builders/DefaultsProviderBuilder.kt index 5a99cc25118..381cb2bc253 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/builders/DefaultsProviderBuilder.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/builders/DefaultsProviderBuilder.kt @@ -12,16 +12,19 @@ import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl import org.jetbrains.kotlin.fir.PrivateForInline import org.jetbrains.kotlin.platform.TargetPlatform import org.jetbrains.kotlin.test.TargetBackend +import org.jetbrains.kotlin.test.model.BinaryKind import org.jetbrains.kotlin.test.services.DefaultsDsl import org.jetbrains.kotlin.test.services.DefaultsProvider import org.jetbrains.kotlin.test.model.DependencyKind import org.jetbrains.kotlin.test.model.FrontendKind +import org.jetbrains.kotlin.test.model.TestArtifactKind @DefaultsDsl class DefaultsProviderBuilder { lateinit var frontend: FrontendKind<*> var targetBackend: TargetBackend? = null lateinit var targetPlatform: TargetPlatform + var artifactKind: BinaryKind<*>? = null lateinit var dependencyKind: DependencyKind @PrivateForInline @@ -44,6 +47,7 @@ class DefaultsProviderBuilder { languageVersionSettings ?: LanguageVersionSettingsImpl(LanguageVersion.LATEST_STABLE, ApiVersion.LATEST_STABLE), languageVersionSettingsBuilder ?: LanguageVersionSettingsBuilder(), targetPlatform, + artifactKind, targetBackend, dependencyKind ) diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/impl/ModuleStructureExtractorImpl.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/impl/ModuleStructureExtractorImpl.kt index 40ccbbe429a..63077ebfd23 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/impl/ModuleStructureExtractorImpl.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/impl/ModuleStructureExtractorImpl.kt @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.test.directives.model.DirectivesContainer import org.jetbrains.kotlin.test.directives.model.RegisteredDirectives import org.jetbrains.kotlin.test.model.* import org.jetbrains.kotlin.test.services.* +import org.jetbrains.kotlin.test.services.impl.TestModuleStructureImpl.Companion.toArtifactKind import org.jetbrains.kotlin.test.util.joinToArrayString import org.jetbrains.kotlin.utils.DFS import java.io.File @@ -275,11 +276,13 @@ class ModuleStructureExtractorImpl( currentModuleLanguageVersionSettingsBuilder.configureUsingDirectives(moduleDirectives, environmentConfigurators) val moduleName = currentModuleName ?: defaultModuleName + val targetPlatform = currentModuleTargetPlatform ?: parseModulePlatformByName(moduleName) ?: defaultsProvider.defaultPlatform val testModule = TestModule( name = moduleName, - targetPlatform = currentModuleTargetPlatform ?: parseModulePlatformByName(moduleName) ?: defaultsProvider.defaultPlatform, + targetPlatform = targetPlatform, targetBackend = currentModuleTargetBackend ?: defaultsProvider.defaultTargetBackend, frontendKind = currentModuleFrontendKind ?: defaultsProvider.defaultFrontend, + binaryKind = defaultsProvider.defaultArtifactKind ?: targetPlatform.toArtifactKind(), files = filesOfCurrentModule, dependencies = dependenciesOfCurrentModule, friends = friendsOfCurrentModule, diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/impl/TestModuleStructureImpl.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/impl/TestModuleStructureImpl.kt index 8b8e0a16151..5c2e74baf4e 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/impl/TestModuleStructureImpl.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/impl/TestModuleStructureImpl.kt @@ -33,7 +33,7 @@ class TestModuleStructureImpl( result += ArtifactKinds.KLib } } - module.targetPlatform.toArtifactKind()?.let { result += it } + result += module.binaryKind put(module.name, result) } } @@ -52,11 +52,11 @@ class TestModuleStructureImpl( } companion object { - private fun TargetPlatform.toArtifactKind(): BinaryKind<*>? = when (this) { + fun TargetPlatform.toArtifactKind(): BinaryKind<*> = when (this) { in JvmPlatforms.allJvmPlatforms -> ArtifactKinds.Jvm in JsPlatforms.allJsPlatforms -> ArtifactKinds.Js in NativePlatforms.allNativePlatforms -> ArtifactKinds.Native - else -> null + else -> BinaryKind.NoArtifact } } }