[Gradle] Add test - setting languagesVersion and apiVersion in languageSettings
KT-58427
This commit is contained in:
committed by
Space Team
parent
f4e8ae5191
commit
4fe60a4149
+24
-1
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerArgumentsProducer.Argume
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerArgumentsProducer.CreateCompilerArgumentsContext.Companion.default
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerArgumentsProducer.CreateCompilerArgumentsContext.Companion.lenient
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType.IR
|
||||
import org.jetbrains.kotlin.gradle.util.buildProjectWithMPP
|
||||
import org.jetbrains.kotlin.gradle.util.main
|
||||
import kotlin.test.Test
|
||||
@@ -30,7 +31,7 @@ class Kotlin2JsCompileArgumentsTest {
|
||||
project.repositories.mavenLocal()
|
||||
|
||||
val kotlin = project.multiplatformExtension
|
||||
val jsTarget = kotlin.js(KotlinJsCompilerType.IR)
|
||||
val jsTarget = kotlin.js(IR)
|
||||
val jsMainCompilation = jsTarget.compilations.main
|
||||
project.evaluate()
|
||||
|
||||
@@ -62,4 +63,26 @@ class Kotlin2JsCompileArgumentsTest {
|
||||
|
||||
assertFails { jsMainCompileTask.createCompilerArguments(default) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test - setting languagesVersion and apiVersion in languageSettings`() {
|
||||
val project = buildProjectWithMPP()
|
||||
val kotlin = project.multiplatformExtension
|
||||
kotlin.jvm()
|
||||
kotlin.linuxX64()
|
||||
val jsTarget = kotlin.js(IR) { nodejs() }
|
||||
|
||||
kotlin.sourceSets.configureEach { sourceSet ->
|
||||
sourceSet.languageSettings.apiVersion = "1.7"
|
||||
sourceSet.languageSettings.languageVersion = "1.8"
|
||||
}
|
||||
|
||||
project.evaluate()
|
||||
|
||||
val arguments = jsTarget.compilations.main.compileTaskProvider.get()
|
||||
.createCompilerArguments(lenient)
|
||||
|
||||
assertEquals("1.7", arguments.apiVersion)
|
||||
assertEquals("1.8", arguments.languageVersion)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user