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 f0c30de5fd7..b0bc024b658 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 @@ -42,8 +42,8 @@ class Kotlin2JsIrGradlePluginIT : KGPBaseTest() { build("build") { checkIrCompilationMessage() - assertFileInProjectExists("build/kotlin2js/main/lib.js") - val dts = projectPath.resolve("build/kotlin2js/main/lib.d.ts") + assertFileInProjectExists("build/js/packages/kotlin2JsIrDtsGeneration/kotlin/kotlin2JsIrDtsGeneration.js") + val dts = projectPath.resolve("build/js/packages/kotlin2JsIrDtsGeneration/kotlin/kotlin2JsIrDtsGeneration.d.ts") assertFileExists(dts) assertFileContains(dts, "function bar(): string") } @@ -696,26 +696,6 @@ class Kotlin2JsIrGradlePluginIT : KGPBaseTest() { assertOutputContains(USING_JS_IR_BACKEND_MESSAGE) } - @DisplayName("js customized output is included into jar") - @GradleTest - fun testJarIncludesJsOutputSetExplicitly(gradleVersion: GradleVersion) { - project("kotlin2JsModuleKind", gradleVersion) { - build(":jar") { - checkIrCompilationMessage() - - assertTasksExecuted(":compileKotlin2Js") - val jarPath = projectPath.resolve("build/libs/kotlin2JsModuleKind.jar") - assertFileExists(jarPath) - ZipFile(jarPath.toFile()).use { jar -> - assertEquals( - 1, jar.entries().asSequence().count { it.name == "app.js" }, - "The jar should contain an entry `app.js` with no duplicates" - ) - } - } - } - } - @DisplayName("test compilation can access main compilation") @GradleTest fun testCompileTestCouldAccessProduction(gradleVersion: GradleVersion) { @@ -724,12 +704,12 @@ class Kotlin2JsIrGradlePluginIT : KGPBaseTest() { checkIrCompilationMessage() assertTasksExecuted( - ":compileKotlin2Js", - ":compileTestKotlin2Js" + ":compileKotlinJs", + ":compileTestKotlinJs" ) - assertFileInProjectExists("build/kotlin2js/main/default/manifest") + assertFileInProjectExists("build/classes/kotlin/main/default/manifest") - assertFileInProjectExists("build/kotlin2js/test/module-tests.js") + assertFileInProjectExists("build/js/packages/kotlin2JsProjectWithTests-test/kotlin/kotlin2JsProjectWithTests-test.js") } } } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsIrDtsGeneration/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsIrDtsGeneration/build.gradle deleted file mode 100644 index fcac04819cf..00000000000 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsIrDtsGeneration/build.gradle +++ /dev/null @@ -1,30 +0,0 @@ -buildscript { - repositories { - mavenLocal() - mavenCentral() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -plugins { - id 'java' -} - -apply plugin: 'org.jetbrains.kotlin.platform.js' - -def outDir = "${buildDir}/kotlin2js/main/" -compileKotlin2Js.kotlinOptions.moduleKind = "plain" -compileKotlin2Js.kotlinOptions.outputFile = outDir + "lib.js" -compileKotlin2Js.kotlinOptions.freeCompilerArgs += ["-Xir-produce-js", "-Xgenerate-dts"] - -repositories { - mavenLocal() - mavenCentral() -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" -} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsIrDtsGeneration/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsIrDtsGeneration/build.gradle.kts new file mode 100644 index 00000000000..a743f86bc83 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsIrDtsGeneration/build.gradle.kts @@ -0,0 +1,16 @@ +plugins { + kotlin("js") +} + +repositories { + mavenLocal() + mavenCentral() +} + +kotlin { + js { + nodejs() + binaries.executable() + generateTypeScriptDefinitions() + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsModuleKind/amd.js b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsModuleKind/amd.js deleted file mode 100644 index 9d42710abe7..00000000000 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsModuleKind/amd.js +++ /dev/null @@ -1,31 +0,0 @@ -(function(global) { - var modules = {}; - - // Hard-code expected dependency order since we are unable to refer to modules by filename here. - var names = ["kotlin", "app", "check"]; - - function define(name, dependencies, body) { - if (Array.isArray(name)) { - body = dependencies; - dependencies = name; - name = names.shift(); - } - else { - if (name !== names.shift()) throw new Error("Unexpected dependency") - } - var resolvedDependencies = []; - var currentModule = {}; - modules[name] = currentModule; - for (var i = 0; i < dependencies.length; ++i) { - var dependencyName = dependencies[i]; - resolvedDependencies[i] = dependencyName === 'exports' ? currentModule : modules[dependencyName]; - } - currentModule = body.apply(body, resolvedDependencies); - if (currentModule) { - modules[name] = currentModule; - } - } - define.amd = {}; - - global.define = define; -})(this); \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsModuleKind/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsModuleKind/build.gradle deleted file mode 100644 index acbc392c723..00000000000 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsModuleKind/build.gradle +++ /dev/null @@ -1,61 +0,0 @@ -buildscript { - repositories { - mavenLocal() - mavenCentral() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -plugins { - id 'java' -} - -apply plugin: 'org.jetbrains.kotlin.platform.js' - -def outDir = "${buildDir}/kotlin2js/main/" -compileKotlin2Js.kotlinOptions.moduleKind = "amd" -compileKotlin2Js.kotlinOptions.outputFile = outDir + "app.js" - -compileKotlin2Js.kotlinOptions.freeCompilerArgs += ["-Xir-produce-js"] - -repositories { - mavenLocal() - mavenCentral() -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" - implementation "org.mozilla:rhino:1.7.7.1" -} - -tasks.register("runRhino", JavaExec) { - classpath = sourceSets.main.runtimeClasspath - workingDir = "${buildDir}/kotlin2js/main/" - mainClass = 'org.mozilla.javascript.tools.shell.Main' - args = ["-opt", "-1", "-f", "amd.js", "-f", "kotlin.js", "-f", "app.js", "-f", "check.js"] -} - -build.doLast { - configurations.compileClasspath.each { File file -> - copy { - includeEmptyDirs = false - - from zipTree(file.absolutePath) - into "${buildDir}/kotlin2js/main/" - include { fileTreeElement -> - def path = fileTreeElement.path - path.endsWith(".js") && (path.startsWith("META-INF/resources/") || !path.startsWith("META-INF/")) - } - } - } - copy { - from "." - include "amd.js" - include "check.js" - into "${buildDir}/kotlin2js/main/" - } -} -runRhino.dependsOn build \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsModuleKind/check.js b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsModuleKind/check.js deleted file mode 100644 index 90985ec44e6..00000000000 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsModuleKind/check.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -define("check", ["app"], function(app) { - if (app.foo.bar() != "OK") { - throw new Error("Unexpected result"); - } -}); \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsModuleKind/gradle.properties b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsModuleKind/gradle.properties deleted file mode 100644 index 777bcc3bbe1..00000000000 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsModuleKind/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -kotlin.internal.mpp12x.deprecation.suppress=true \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsModuleKind/src/main/kotlin/org/jetbrains/HelloWorld.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsModuleKind/src/main/kotlin/org/jetbrains/HelloWorld.kt deleted file mode 100644 index 8f2f5fcd49b..00000000000 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsModuleKind/src/main/kotlin/org/jetbrains/HelloWorld.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package foo - -@JsExport -fun bar() = "OK" diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsProjectWithTests/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsProjectWithTests/build.gradle deleted file mode 100644 index 95a15d31fd8..00000000000 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsProjectWithTests/build.gradle +++ /dev/null @@ -1,35 +0,0 @@ -buildscript { - repositories { - mavenLocal() - mavenCentral() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -apply plugin: 'org.jetbrains.kotlin.platform.js' - -repositories { - mavenLocal() - mavenCentral() -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" - testImplementation"org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" -} - -tasks.register("jarSources", Jar) { - from sourceSets.main.allSource - archiveClassifier = 'source' -} -artifacts { - implementation jarSources -} - -compileTestKotlin2Js.kotlinOptions.outputFile = "${buildDir}/kotlin2js/test/module-tests.js" - -compileKotlin2Js.kotlinOptions.freeCompilerArgs += ["-Xir-produce-klib-dir", "-Xir-only"] -compileTestKotlin2Js.kotlinOptions.freeCompilerArgs += ["-Xir-produce-js"] -compileKotlin2Js.kotlinOptions.outputFile = "${buildDir}/kotlin2js/main/" \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsProjectWithTests/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsProjectWithTests/build.gradle.kts new file mode 100644 index 00000000000..566d104f108 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kotlin2JsProjectWithTests/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + kotlin("js") +} + +repositories { + mavenLocal() + mavenCentral() +} + +val kotlin_version: String by extra + +dependencies { + testImplementation("org.jetbrains.kotlin:kotlin-test-js:$kotlin_version") +} + +kotlin { + js { + binaries.executable() + nodejs() + } +} \ No newline at end of file diff --git a/tests/mute-common.csv b/tests/mute-common.csv index 8203ef4be80..eb2476e2b92 100644 --- a/tests/mute-common.csv +++ b/tests/mute-common.csv @@ -96,9 +96,4 @@ org.jetbrains.kotlin.jps.build.IncrementalK2LightTreeJvmJpsTestGenerated.Increme org.jetbrains.kotlin.jps.build.IncrementalK2FirICLightTreeJvmJpsTestGenerated.IncrementalJvmCompilerOnly.testAddAnnotationToJavaClass, KT-55696,, org.jetbrains.kotlin.jps.build.IncrementalK2JvmJpsTestGenerated.PureKotlin.testAllConstants, test should be changed and fixed in next commits - KT-54991,, org.jetbrains.kotlin.jps.build.IncrementalK2LightTreeJvmJpsTestGenerated.PureKotlin.testAllConstants, test should be changed and fixed in next commits - KT-54991,, -org.jetbrains.kotlin.jps.build.IncrementalK2FirICLightTreeJvmJpsTestGenerated.PureKotlin.testAllConstants, test should be changed and fixed in next commits - KT-54991,, -org.jetbrains.kotlin.gradle.Kotlin2JsIrGradlePluginIT.generateDts, org.jetbrains.kotlin.platform.js legacy plugin,, -org.jetbrains.kotlin.gradle.Kotlin2JsIrGradlePluginIT.testJarIncludesJsOutputSetExplicitly, org.jetbrains.kotlin.platform.js legacy plugin,, -org.jetbrains.kotlin.gradle.Kotlin2JsIrGradlePluginIT.testCompileTestCouldAccessProduction, org.jetbrains.kotlin.platform.js legacy plugin,, -org.jetbrains.kotlin.gradle.Kotlin2JsGradlePluginIT.testJarIncludesJsOutputSetExplicitly, org.jetbrains.kotlin.platform.js legacy plugin,, -org.jetbrains.kotlin.gradle.Kotlin2JsGradlePluginIT.testCompileTestCouldAccessProduction, org.jetbrains.kotlin.platform.js legacy plugin,, \ No newline at end of file +org.jetbrains.kotlin.jps.build.IncrementalK2FirICLightTreeJvmJpsTestGenerated.PureKotlin.testAllConstants, test should be changed and fixed in next commits - KT-54991,, \ No newline at end of file