[K2/N/MPP] Disable one-stage MPP compilation
^KT-56855 Merge-request: KT-MR-10735 Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
bde6df8ca1
commit
4d9f93e4eb
@@ -20,10 +20,7 @@ import org.jetbrains.kotlin.cli.common.messages.MessageRenderer
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||
import org.jetbrains.kotlin.config.Services
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.partialLinkageConfig
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.setupPartialLinkageConfig
|
||||
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
||||
@@ -69,7 +66,7 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
|
||||
if (!enoughArguments) {
|
||||
messageCollector.report(ERROR, "You have not specified any compilation arguments. No output has been produced.")
|
||||
}
|
||||
if(configuration.get(KonanConfigKeys.PRODUCE) != CompilerOutputKind.LIBRARY &&
|
||||
if (configuration.get(KonanConfigKeys.PRODUCE) != CompilerOutputKind.LIBRARY &&
|
||||
configuration.getBoolean(CommonConfigurationKeys.USE_FIR) &&
|
||||
configuration.kotlinSourceRoots.isNotEmpty()) {
|
||||
// K2/Native backend cannot produce binary directly from FIR frontend output, since descriptors, deserialized from KLib, are needed
|
||||
@@ -79,6 +76,17 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
|
||||
// In this implementation, 'arguments' is not changed accordingly to changes in `firstStageConfiguration` and `configuration`,
|
||||
// since values of fields `produce`, `output`, `freeArgs`, `includes` does not seem to matter downstream in prepareEnvironment()
|
||||
|
||||
if (configuration.get(CommonConfigurationKeys.LANGUAGE_VERSION_SETTINGS)
|
||||
?.getFeatureSupport(LanguageFeature.MultiPlatformProjects) == LanguageFeature.State.ENABLED)
|
||||
messageCollector.report(ERROR,
|
||||
"""
|
||||
Producing a multiplatform library directly from sources is not allowed.
|
||||
|
||||
If you use the command-line compiler, then first compile the sources to a KLIB with
|
||||
the `-p library` compiler flag. Then, use '-Xinclude=<klib>' to pass the KLIB to
|
||||
the compiler to produce the required type of binary artifact.
|
||||
""".trimIndent())
|
||||
|
||||
val firstStageConfiguration = configuration.copy()
|
||||
// For the first stage, use "-p library" produce mode
|
||||
firstStageConfiguration.put(KonanConfigKeys.PRODUCE, CompilerOutputKind.LIBRARY)
|
||||
|
||||
+2
-2
@@ -58,8 +58,8 @@ internal val FrontendPhase = createSimpleNamedCompilerPhase(
|
||||
|
||||
if (sourceFiles.isNotEmpty()) {
|
||||
require (!input.configuration.getBoolean(CommonConfigurationKeys.USE_FIR)) {
|
||||
"For K2 compiler, no source files should have been passed here. " +
|
||||
"K2Native.doExecute() must transform such compilation into two-stage compilation"
|
||||
"Internal error: For K2 compiler, no source files should have been passed here. " +
|
||||
"K2Native.doExecute() must transform such compilation into two-stage compilation.\n"
|
||||
}
|
||||
} else {
|
||||
// TODO: we shouldn't be here in this case.
|
||||
|
||||
+6
-1
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.*
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.TestCase.WithTestRunnerExtras
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.runner.TestRunChecks
|
||||
@@ -26,7 +27,6 @@ import org.jetbrains.kotlin.konan.blackboxtest.support.util.*
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.addRemoveModifier.addAnnotationEntry
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getChildOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getChildrenOfType
|
||||
import org.jetbrains.kotlin.resolve.ImportPath
|
||||
@@ -74,6 +74,7 @@ internal class ExtTestCaseGroupProvider : TestCaseGroupProvider, TestDisposable(
|
||||
generatedSources = settings.get(),
|
||||
customKlibs = settings.get(),
|
||||
pipelineType = settings.get(),
|
||||
testMode = settings.get(),
|
||||
timeouts = settings.get(),
|
||||
)
|
||||
|
||||
@@ -99,6 +100,7 @@ private class ExtTestDataFile(
|
||||
private val generatedSources: GeneratedSources,
|
||||
private val customKlibs: CustomKlibs,
|
||||
private val pipelineType: PipelineType,
|
||||
private val testMode: TestMode,
|
||||
private val timeouts: Timeouts,
|
||||
) {
|
||||
private val structure by lazy {
|
||||
@@ -143,6 +145,9 @@ private class ExtTestDataFile(
|
||||
&& INCOMPATIBLE_DIRECTIVES.none { it in structure.directives }
|
||||
&& structure.directives[API_VERSION_DIRECTIVE] !in INCOMPATIBLE_API_VERSIONS
|
||||
&& structure.directives[LANGUAGE_VERSION_DIRECTIVE] !in INCOMPATIBLE_LANGUAGE_VERSIONS
|
||||
&& !(testDataFileSettings.languageSettings.contains("+${LanguageFeature.MultiPlatformProjects.name}")
|
||||
&& pipelineType == PipelineType.K2
|
||||
&& testMode == TestMode.ONE_STAGE_MULTI_MODULE)
|
||||
|
||||
private fun isIgnoredTarget(pipelineType: PipelineType, testDataFile: File, backend: TargetBackend): Boolean {
|
||||
return when (pipelineType) {
|
||||
|
||||
Reference in New Issue
Block a user