Explicitly use language version 1.9 for K2-unsupported parts

This commit explicitly sets LV 1.9 for all projects with disabled FIR
bootstrap, as well as for libraries, including Native stdlib.

Related to KT-59171
This commit is contained in:
Mikhail Glukhikh
2023-07-14 23:45:27 +02:00
committed by Space Team
parent 648c1f4599
commit e76cf24d01
3 changed files with 16 additions and 2 deletions
+2
View File
@@ -589,6 +589,8 @@ konanArtifacts {
"-opt-in=kotlin.contracts.ExperimentalContracts",
"-opt-in=kotlin.ExperimentalMultiplatform",
"-opt-in=kotlin.native.internal.InternalForKotlinNative",
"-language-version",
"1.9",
)
commonStdlibSrcDirs.forEach { commonSrcDir(it) }
@@ -13,6 +13,7 @@ import org.gradle.api.plugins.BasePluginExtension
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.kotlin.dsl.*
import org.gradle.process.CommandLineArgumentProvider
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
@@ -71,8 +72,14 @@ fun Project.configureFrontendIr() = tasks.withType<KotlinJvmCompile>().configure
if (project.kotlinBuildProperties.useFirForLibraries) {
freeCompilerArgs.add("-Xuse-k2")
allWarningsAsErrors.set(false)
} else if (project.kotlinBuildProperties.useFir) {
freeCompilerArgs.add("-Xskip-prerelease-check")
} else {
if (project.kotlinBuildProperties.useFir) {
freeCompilerArgs.add("-Xskip-prerelease-check")
}
if (languageVersion.get() >= KotlinVersion.KOTLIN_2_0) {
languageVersion.set(KotlinVersion.KOTLIN_1_9)
progressiveMode.set(false)
}
}
val renderDiagnosticNames by extra(project.kotlinBuildProperties.renderDiagnosticNames)
@@ -1,4 +1,5 @@
import org.gradle.internal.deprecation.DeprecatableConfiguration
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper
// Contains common configuration that should be applied to all projects
@@ -196,6 +197,10 @@ fun Project.configureKotlinCompilationOptions() {
freeCompilerArgs += "-Xskip-prerelease-check"
}
}
if (KotlinVersion.DEFAULT >= KotlinVersion.KOTLIN_2_0 && project.path in projectsWithDisabledFirBootstrap) {
languageVersion = "1.9"
options.progressiveMode.set(false)
}
if (renderDiagnosticNames) {
freeCompilerArgs += "-Xrender-internal-diagnostic-names"
}