diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kotlin2JsGradlePluginIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kotlin2JsGradlePluginIT.kt index 35e35f93388..ee9e982d147 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kotlin2JsGradlePluginIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kotlin2JsGradlePluginIT.kt @@ -53,7 +53,8 @@ class Kotlin2JsIrGradlePluginIT : AbstractKotlin2JsGradlePluginIT(true) { gradleBuildScript().appendText( """${"\n"} tasks { - compileProductionKotlinJs { + named("compileProductionKotlinJs").configure { + this as org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrLink type = org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrType.DEVELOPMENT } } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt index 14a54d323d3..c1dae312371 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.gradle import org.jdom.input.SAXBuilder import org.jetbrains.kotlin.gradle.internals.* -import org.jetbrains.kotlin.gradle.plugin.JsCompilerType import org.jetbrains.kotlin.gradle.plugin.ProjectLocalConfigurations import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmWithJavaTargetPreset import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin @@ -66,49 +65,18 @@ class NewMultiplatformIT : BaseGradleIT() { @Test fun testLibAndApp() = doTestLibAndApp( "sample-lib", - "sample-app", - JsCompilerType.legacy - ) - - @Test - fun testLibAndAppJsIr() = doTestLibAndApp( - "sample-lib", - "sample-app", - JsCompilerType.ir - ) - - @Test - fun testLibAndAppJsMixed() = doTestLibAndApp( - "sample-lib", - "sample-app", - JsCompilerType.both + "sample-app" ) @Test fun testLibAndAppWithGradleKotlinDsl() = doTestLibAndApp( "sample-lib-gradle-kotlin-dsl", - "sample-app-gradle-kotlin-dsl", - JsCompilerType.legacy - ) - - @Test - fun testLibAndAppWithGradleKotlinDslJsIr() = doTestLibAndApp( - "sample-lib-gradle-kotlin-dsl", - "sample-app-gradle-kotlin-dsl", - JsCompilerType.ir - ) - - @Test - fun testLibAndAppWithGradleKotlinDslJsMixed() = doTestLibAndApp( - "sample-lib-gradle-kotlin-dsl", - "sample-app-gradle-kotlin-dsl", - JsCompilerType.both + "sample-app-gradle-kotlin-dsl" ) private fun doTestLibAndApp( libProjectName: String, - appProjectName: String, - jsCompilerType: JsCompilerType + appProjectName: String ) { val libProject = transformProjectWithPluginsDsl(libProjectName, directoryPrefix = "new-mpp-lib-and-app") val appProject = transformProjectWithPluginsDsl(appProjectName, directoryPrefix = "new-mpp-lib-and-app") @@ -119,15 +87,14 @@ class NewMultiplatformIT : BaseGradleIT() { with(libProject) { build( - "publish", - options = defaultBuildOptions().copy(jsCompilerType = jsCompilerType) + "publish" ) { assertSuccessful() assertTasksExecuted(*compileTasksNames.toTypedArray(), ":jvm6Jar", ":nodeJsJar", ":metadataJar") val groupDir = projectDir.resolve("repo/com/example") val jvmJarName = "sample-lib-jvm6/1.0/sample-lib-jvm6-1.0.jar" - val jsExtension = if (jsCompilerType == JsCompilerType.legacy) "jar" else "klib" + val jsExtension = "jar" val jsJarName = "sample-lib-nodejs/1.0/sample-lib-nodejs-1.0.$jsExtension" val metadataJarName = "sample-lib-metadata/1.0/sample-lib-metadata-1.0.jar" val wasmKlibName = "sample-lib-wasm32/1.0/sample-lib-wasm32-1.0.klib" @@ -156,19 +123,12 @@ class NewMultiplatformIT : BaseGradleIT() { Assert.assertTrue("com/example/lib/CommonKt.class" in jvmJarEntries) Assert.assertTrue("com/example/lib/MainKt.class" in jvmJarEntries) - when (jsCompilerType) { - JsCompilerType.legacy -> { - val jsJar = ZipFile(groupDir.resolve(jsJarName)) - val compiledJs = jsJar.getInputStream(jsJar.getEntry("sample-lib.js")).reader().readText() - Assert.assertTrue("function id(" in compiledJs) - Assert.assertTrue("function idUsage(" in compiledJs) - Assert.assertTrue("function expectedFun(" in compiledJs) - Assert.assertTrue("function main(" in compiledJs) - } - JsCompilerType.ir -> { - groupDir.resolve(jsJarName).exists() - } - } + val jsJar = ZipFile(groupDir.resolve(jsJarName)) + val compiledJs = jsJar.getInputStream(jsJar.getEntry("sample-lib.js")).reader().readText() + Assert.assertTrue("function id(" in compiledJs) + Assert.assertTrue("function idUsage(" in compiledJs) + Assert.assertTrue("function expectedFun(" in compiledJs) + Assert.assertTrue("function main(" in compiledJs) val metadataJarEntries = ZipFile(groupDir.resolve(metadataJarName)).entries().asSequence().map { it.name }.toSet() Assert.assertTrue("com/example/lib/CommonKt.kotlin_metadata" in metadataJarEntries) @@ -213,11 +173,9 @@ class NewMultiplatformIT : BaseGradleIT() { Assert.assertTrue(resolve("com/example/app/AKt.kotlin_metadata").exists()) } - if (jsCompilerType == JsCompilerType.legacy) { - projectDir.resolve(targetClassesDir("nodeJs")).resolve("sample-app.js").readText().run { - Assert.assertTrue(contains("console.info")) - Assert.assertTrue(contains("function nodeJsMain(")) - } + projectDir.resolve(targetClassesDir("nodeJs")).resolve("sample-app.js").readText().run { + Assert.assertTrue(contains("console.info")) + Assert.assertTrue(contains("function nodeJsMain(")) } projectDir.resolve(targetClassesDir("wasm32")).run { @@ -241,30 +199,12 @@ class NewMultiplatformIT : BaseGradleIT() { build( "assemble", - "resolveRuntimeDependencies", - options = defaultBuildOptions().copy(jsCompilerType = jsCompilerType) + "resolveRuntimeDependencies" ) { checkAppBuild() assertTasksExecuted(":resolveRuntimeDependencies") // KT-26301 } - if (jsCompilerType == JsCompilerType.both) { - listOf( - JsCompilerType.legacy, - JsCompilerType.ir - ).forEach { - build( - "assemble", - "resolveRuntimeDependencies", - "--rerun-tasks", - options = defaultBuildOptions().copy(jsCompilerType = it) - ) { - checkAppBuild() - assertTasksExecuted(":resolveRuntimeDependencies") // KT-26301 - } - } - } - // Now run again with a project dependency instead of a module one: libProject.projectDir.copyRecursively(projectDir.resolve(libProject.projectDir.name)) gradleSettingsScript().appendText("\ninclude(\"${libProject.projectDir.name}\")") @@ -277,15 +217,12 @@ class NewMultiplatformIT : BaseGradleIT() { build( "clean", "assemble", - "--rerun-tasks", - options = defaultBuildOptions().copy(jsCompilerType = jsCompilerType) + "--rerun-tasks" ) { checkAppBuild() } } - if (jsCompilerType != JsCompilerType.legacy) return - with(oldStyleAppProject) { setupWorkingDir() gradleBuildScript().appendText("\nallprojects { repositories { maven { url '$libLocalRepoUri' } } }") @@ -899,8 +836,7 @@ class NewMultiplatformIT : BaseGradleIT() { setupWorkingDir() projectDir.resolve("settings.gradle").modify { it.replace("enableFeaturePreview", "// enableFeaturePreview") } build( - "publish", - options = defaultBuildOptions().copy(jsCompilerType = JsCompilerType.legacy) + "publish" ) { assertSuccessful() } projectDir.resolve("repo") } @@ -2308,15 +2244,10 @@ class NewMultiplatformIT : BaseGradleIT() { @Test fun testAssociateCompilations() { - testAssociateCompilationsImpl(JsCompilerType.legacy) + testAssociateCompilationsImpl() } - @Test - fun testAssociateCompilationsWithJsIr() { - testAssociateCompilationsImpl(JsCompilerType.ir) - } - - private fun testAssociateCompilationsImpl(jsCompilerType: JsCompilerType) { + private fun testAssociateCompilationsImpl() { with(Project("new-mpp-associate-compilations", GradleVersionRequired.AtLeast("5.0"))) { setupWorkingDir() gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl) @@ -2324,10 +2255,7 @@ class NewMultiplatformIT : BaseGradleIT() { val tasks = listOf("jvm", "js", nativeHostTargetName).map { ":compileIntegrationTestKotlin${it.capitalize()}" } build( - *tasks.toTypedArray(), - options = defaultBuildOptions().copy( - jsCompilerType = jsCompilerType - ) + *tasks.toTypedArray() ) { assertSuccessful() assertTasksExecuted(*tasks.toTypedArray()) @@ -2342,11 +2270,7 @@ class NewMultiplatformIT : BaseGradleIT() { // JS: assertFileExists( - if (jsCompilerType == JsCompilerType.ir) { - "build/classes/kotlin/js/integrationTest/default/manifest" - } else { - "build/classes/kotlin/js/integrationTest/new-mpp-associate-compilations_integrationTest.js" - } + "build/classes/kotlin/js/integrationTest/new-mpp-associate-compilations_integrationTest.js" ) // Native: