[Gradle] Add multiplatform compiler options DSL integration test
^KT-57292 Fixed
This commit is contained in:
committed by
Space Team
parent
07593da3f0
commit
1b82477ffa
+77
@@ -477,4 +477,81 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@GradleTest
|
||||
@DisplayName("Multiplatform compiler option DSL hierarchy")
|
||||
@JvmGradlePluginTests
|
||||
fun mppCompilerOptionsDsl(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
projectName = "mpp-default-hierarchy",
|
||||
gradleVersion = gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)
|
||||
) {
|
||||
buildGradle.modify {
|
||||
it.substringBefore("kotlin {") +
|
||||
//language=Groovy
|
||||
"""
|
||||
|
|
||||
|import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
||||
|
|
||||
|kotlin {
|
||||
| jvm {
|
||||
| compilerOptions {
|
||||
| languageVersion = KotlinVersion.KOTLIN_1_8
|
||||
| apiVersion = KotlinVersion.KOTLIN_1_8
|
||||
| jvmTarget.value(JvmTarget.JVM_11).disallowChanges()
|
||||
| javaParameters = true
|
||||
| }
|
||||
| }
|
||||
|
|
||||
| js {
|
||||
| compilerOptions {
|
||||
| languageVersion = KotlinVersion.KOTLIN_2_0
|
||||
| apiVersion = KotlinVersion.KOTLIN_2_0
|
||||
| friendModulesDisabled = true
|
||||
| }
|
||||
| }
|
||||
|
|
||||
| linuxX64 {
|
||||
| compilerOptions {
|
||||
| progressiveMode = true
|
||||
| }
|
||||
| }
|
||||
|
|
||||
| compilerOptions {
|
||||
| languageVersion = KotlinVersion.KOTLIN_1_7
|
||||
| apiVersion = KotlinVersion.KOTLIN_1_7
|
||||
| }
|
||||
|}
|
||||
""".trimMargin()
|
||||
}
|
||||
|
||||
build(":compileCommonMainKotlinMetadata") {
|
||||
assertCompilerArguments(":compileCommonMainKotlinMetadata", "-language-version 1.7", "-api-version 1.7")
|
||||
}
|
||||
|
||||
build(":compileKotlinJvm", enableGradleDebug = true) {
|
||||
assertCompilerArguments(
|
||||
":compileKotlinJvm",
|
||||
"-language-version 1.8",
|
||||
"-api-version 1.8",
|
||||
"-java-parameters",
|
||||
"-jvm-target 11"
|
||||
)
|
||||
}
|
||||
|
||||
build(":compileKotlinJs") {
|
||||
assertCompilerArguments(":compileKotlinJs", "-language-version 2.0", "-api-version 2.0", "-Xfriend-modules-disabled")
|
||||
}
|
||||
|
||||
build(":compileKotlinLinuxX64") {
|
||||
extractNativeTasksCommandLineArgumentsFromOutput(":compileKotlinLinuxX64") {
|
||||
assertCommandLineArgumentsContain("-language-version", "1.7")
|
||||
assertCommandLineArgumentsContain("-api-version", "1.7")
|
||||
assertCommandLineArgumentsContain("-progressive")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package com.example
|
||||
|
||||
class Logger {
|
||||
fun printLog(text: String) {
|
||||
println("LOG: $text")
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package com.example
|
||||
|
||||
fun main() {
|
||||
Logger().printLog("Hello!")
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package com.example
|
||||
|
||||
fun main() {
|
||||
Logger().printLog("Hello!")
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package com.example
|
||||
|
||||
fun main() {
|
||||
Logger().printLog("Hello!")
|
||||
}
|
||||
Reference in New Issue
Block a user