[Gradle] Fix tryK2 was not applied to Kotlin/JS gradle plugin
^KT-61193 Fixed
This commit is contained in:
committed by
Space Team
parent
c42d19f0e5
commit
7d48a7934f
+44
@@ -259,6 +259,50 @@ class TryK2IT : KGPBaseTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("JS: language version default is changed to 2.0")
|
||||
@JsGradlePluginTests
|
||||
@GradleTest
|
||||
fun jsLanguageVersionK2(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
"kotlin-js-nodejs-project",
|
||||
gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)
|
||||
) {
|
||||
enableTryK2()
|
||||
|
||||
build(":compileKotlinJs") {
|
||||
assertTasksExecuted(":compileKotlinJs")
|
||||
|
||||
assertCompilerArgument(":compileKotlinJs", "-language-version 2.0")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("JS: tryK2 report is produced")
|
||||
@JsGradlePluginTests
|
||||
@GradleTest
|
||||
fun jsTryReport(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
"kotlin-js-nodejs-project",
|
||||
gradleVersion,
|
||||
) {
|
||||
enableTryK2()
|
||||
|
||||
build("build") {
|
||||
assertOutputContains(
|
||||
"""
|
||||
|##### 'kotlin.experimental.tryK2' results #####
|
||||
|:compileKotlinJs: 2.0 language version
|
||||
|:compileProductionExecutableKotlinJs: 2.0 language version
|
||||
|:compileTestKotlinJs: 2.0 language version
|
||||
|:compileTestDevelopmentExecutableKotlinJs: 2.0 language version
|
||||
|##### 100% (4/4) tasks have been compiled with Kotlin 2.0 #####
|
||||
""".trimMargin().normalizeLineEndings()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun TestProject.enableTryK2() = gradleProperties.appendText(
|
||||
"""
|
||||
|
|
||||
|
||||
+4
@@ -92,5 +92,9 @@ open class KotlinJsPlugin: Plugin<Project> {
|
||||
// Also create predefined source sets
|
||||
kotlinExtension.sourceSets.maybeCreate(MAIN_COMPILATION_NAME)
|
||||
kotlinExtension.sourceSets.maybeCreate(TEST_COMPILATION_NAME)
|
||||
|
||||
kotlinExtension.registerTargetObserver { target ->
|
||||
target?.compilerOptions?.configureExperimentalTryK2(project)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user