[stdlib] Set AV to 2.0, LV to 1.9 for main compilations, build tests with K2

This commit is contained in:
Ilya Gorbunov
2024-02-20 03:38:22 +01:00
committed by Space Team
parent 6152022838
commit 0ecbbbf1ca
7 changed files with 38 additions and 10 deletions
+24 -7
View File
@@ -1,6 +1,7 @@
@file:Suppress("UNUSED_VARIABLE", "NAME_SHADOWING")
import org.gradle.jvm.tasks.Jar
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptions
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.plugin.mpp.GenerateProjectStructureMetadata
@@ -40,6 +41,12 @@ fun outgoingConfiguration(name: String, configure: Action<Configuration> = Actio
configure(this)
}
fun KotlinCommonCompilerOptions.mainCompilationWithK1() {
languageVersion = KotlinVersion.KOTLIN_1_9
apiVersion = KotlinVersion.KOTLIN_2_0
freeCompilerArgs.add("-Xsuppress-api-version-greater-than-language-version-error")
}
val configurationBuiltins = resolvingConfiguration("builtins") {
attributes.attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements.JAR))
}
@@ -83,9 +90,10 @@ kotlin {
diagnosticNamesArg,
)
)
mainCompilationWithK1()
// workaround for compiling legacy MPP metadata, remove when this compilation is not needed anymore
// restate the list of opt-ins
compilerOptions.optIn.addAll(commonOptIns)
optIn.addAll(commonOptIns)
}
}
}
@@ -122,6 +130,7 @@ kotlin {
diagnosticNamesArg,
)
)
mainCompilationWithK1()
}
}
defaultSourceSet {
@@ -147,6 +156,7 @@ kotlin {
diagnosticNamesArg,
)
)
mainCompilationWithK1()
}
}
}
@@ -165,6 +175,7 @@ kotlin {
diagnosticNamesArg,
)
)
mainCompilationWithK1()
}
}
}
@@ -219,15 +230,16 @@ kotlin {
compilations {
all {
kotlinOptions {
freeCompilerArgs += "-Xallow-kotlin-package"
freeCompilerArgs += listOf(
"-Xallow-kotlin-package",
"-Xexpect-actual-classes",
)
}
}
val main by getting
main.apply {
val main by getting {
kotlinOptions {
freeCompilerArgs += listOfNotNull(
"-Xir-module-name=kotlin",
"-Xexpect-actual-classes",
diagnosticNamesArg,
)
@@ -235,6 +247,9 @@ kotlin {
allWarningsAsErrors = true
}
}
compileTaskProvider.configure {
compilerOptions.mainCompilationWithK1()
}
}
}
}
@@ -251,10 +266,12 @@ kotlin {
diagnosticNamesArg
)
}
val main by getting
main.apply {
val main by getting {
kotlinOptions.freeCompilerArgs += "-Xir-module-name=kotlin"
kotlinOptions.allWarningsAsErrors = true
compileTaskProvider.configure {
compilerOptions.mainCompilationWithK1()
}
}
}
}