[K/N] Don't pass -language_version to the second stage of new test system.

^KT-56182
Merge-request: KT-MR-10414
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
Vladimir Sukharev
2023-06-05 17:59:16 +00:00
committed by Space Team
parent 833b5c12a1
commit 37adc99b9a
3 changed files with 21 additions and 16 deletions
@@ -485,19 +485,18 @@ internal class CAdapterGenerator(
it.module in moduleDescriptors } it.module in moduleDescriptors }
visitChildren(fragments) visitChildren(fragments)
if (configuration.get(USE_FIR) == true) { // K2 does not serialize empty package fragments, thus breaking the scope chain.
// K2 does not serialize empty package fragments, thus breaking the scope chain. // The following traverse definitely reaches every subpackage fragment.
// The following traverse definitely reaches every subpackage fragment. scopes.push(getPackageScope(FqName.ROOT))
scopes.push(getPackageScope(FqName.ROOT)) val subfragments = descriptor.module.getSubPackagesOf(FqName.ROOT) { true }
val subfragments = descriptor.module.getSubPackagesOf(FqName.ROOT) { true } .flatMap {
.flatMap { descriptor.module.getPackage(it).fragments.filter {
descriptor.module.getPackage(it).fragments.filter { it.module in moduleDescriptors
it.module in moduleDescriptors
}
} }
visitChildren(subfragments) }
scopes.pop() visitChildren(subfragments)
} scopes.pop()
return true return true
} }
@@ -149,10 +149,10 @@ abstract class KonanCompileTask: KonanBuildingTask(), KonanCompileSpec {
.excludeFlags("-Xcoverage") .excludeFlags("-Xcoverage")
.excludeArguments("-Xcoverage-file", "-Xlibrary-to-cover", "-Xpartial-linkage", "-Xpartial-linkage-loglevel") .excludeArguments("-Xcoverage-file", "-Xlibrary-to-cover", "-Xpartial-linkage", "-Xpartial-linkage-loglevel")
// Don't include the -Xemit-lazy-objc-header flag into // Don't include the -Xemit-lazy-objc-header and -language-version flags into
// the second stage because this stage have no sources. // the second stage because this stage have no sources.
private fun secondStageExtraOpts() = extraOpts private fun secondStageExtraOpts() = extraOpts
.excludeArguments("-Xemit-lazy-objc-header") .excludeArguments("-Xemit-lazy-objc-header", "-language-version")
/** Args passed to the compiler at the first stage of two-stage compilation (klib building). */ /** Args passed to the compiler at the first stage of two-stage compilation (klib building). */
protected fun buildFirstStageArgs(klibPath: String) = mutableListOf<String>().apply { protected fun buildFirstStageArgs(klibPath: String) = mutableListOf<String>().apply {
@@ -226,7 +226,7 @@ internal class ObjCFrameworkCompilation(
sanitizer = settings.get(), sanitizer = settings.get(),
gcType = settings.get(), gcType = settings.get(),
gcScheduler = settings.get(), gcScheduler = settings.get(),
pipelineType = settings.get(), pipelineType = settings.getStageDependentPipelineType(),
freeCompilerArgs = freeCompilerArgs, freeCompilerArgs = freeCompilerArgs,
sourceModules = sourceModules, sourceModules = sourceModules,
dependencies = CategorizedDependencies(dependencies), dependencies = CategorizedDependencies(dependencies),
@@ -310,7 +310,7 @@ internal class ExecutableCompilation(
sanitizer = settings.get(), sanitizer = settings.get(),
gcType = settings.get(), gcType = settings.get(),
gcScheduler = settings.get(), gcScheduler = settings.get(),
pipelineType = settings.get(), pipelineType = settings.getStageDependentPipelineType(),
freeCompilerArgs = freeCompilerArgs, freeCompilerArgs = freeCompilerArgs,
sourceModules = sourceModules, sourceModules = sourceModules,
dependencies = CategorizedDependencies(dependencies), dependencies = CategorizedDependencies(dependencies),
@@ -506,3 +506,9 @@ private object BinaryOptions {
fun chooseFor(cacheMode: CacheMode) = if (cacheMode.useStaticCacheForDistributionLibraries) forUseWithCache else defaultForTesting fun chooseFor(cacheMode: CacheMode) = if (cacheMode.useStaticCacheForDistributionLibraries) forUseWithCache else defaultForTesting
} }
} }
internal fun Settings.getStageDependentPipelineType(): PipelineType =
when (get<TestMode>()) {
TestMode.ONE_STAGE_MULTI_MODULE -> get<PipelineType>()
TestMode.TWO_STAGE_MULTI_MODULE -> PipelineType.K1 // Don't pass "-language_version 2.0" to the second stage
}