diff --git a/.space/CODEOWNERS b/.space/CODEOWNERS index d465b1fda7b..7a61378612e 100644 --- a/.space/CODEOWNERS +++ b/.space/CODEOWNERS @@ -261,8 +261,6 @@ /libraries/examples/annotation-processor-example/ "Kotlin Compiler Core" /libraries/examples/kotlin-gradle-subplugin-example/ "Kotlin Compiler Core" /libraries/examples/kotlin-java-example/ "Kotlin JVM" -/libraries/examples/kotlin-jsr223-daemon-local-eval-example/ "Kotlin Compiler Core" -/libraries/examples/kotlin-jsr223-local-example/ "Kotlin Compiler Core" /libraries/examples/scripting/ "Kotlin Compiler Core" /libraries/kotlin.test/ A.Qurbonzoda Vsevolod.Tolstopyato Ilya.Gorbunov /libraries/kotlinx-metadata/ Alexander.Udalov A.Qurbonzoda Vsevolod.Tolstopyato Ilya.Gorbunov diff --git a/build.gradle.kts b/build.gradle.kts index ac6e70ff8d6..be4d3cc2344 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -693,7 +693,6 @@ tasks { register("scriptingJvmTest") { dependsOn("dist") - dependsOn(":kotlin-script-util:test") dependsOn(":kotlin-scripting-compiler:test") dependsOn(":kotlin-scripting-compiler:testWithIr") dependsOn(":kotlin-scripting-common:test") @@ -706,7 +705,6 @@ tasks { // see comments on the task in kotlin-scripting-jvm-host-test // dependsOn(":kotlin-scripting-jvm-host-test:embeddableTest") dependsOn(":kotlin-scripting-jsr223-test:embeddableTest") - dependsOn(":kotlin-main-kts-test:test") dependsOn(":kotlin-scripting-ide-services-test:test") dependsOn(":kotlin-scripting-ide-services-test:embeddableTest") } diff --git a/libraries/examples/kotlin-jsr223-daemon-local-eval-example/build.gradle.kts b/libraries/examples/kotlin-jsr223-daemon-local-eval-example/build.gradle.kts deleted file mode 100644 index 24b1b68d197..00000000000 --- a/libraries/examples/kotlin-jsr223-daemon-local-eval-example/build.gradle.kts +++ /dev/null @@ -1,50 +0,0 @@ -import org.jetbrains.kotlin.pill.PillExtension - -description = "Sample Kotlin JSR 223 scripting jar with daemon (out-of-process) compilation and local (in-process) evaluation" - -plugins { - kotlin("jvm") - id("jps-compatible") -} - -pill { - variant = PillExtension.Variant.FULL -} - -val compilerClasspath by configurations.creating { - attributes { - attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) - attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY)) - } -} - -dependencies { - testApi(kotlinStdlib()) - testApi(project(":kotlin-script-runtime")) - testApi(project(":kotlin-script-util")) - testApi(project(":kotlin-daemon-client")) - testApi(project(":kotlin-daemon-embeddable")) - testApi(project(":kotlin-compiler-embeddable")) - testApi(commonDependency("junit:junit")) - testApi(project(":kotlin-test:kotlin-test-junit")) - compilerClasspath(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false } - compilerClasspath(kotlinStdlib()) - compilerClasspath(commonDependency("org.jetbrains.intellij.deps", "trove4j")) - compilerClasspath(commonDependency("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) - compilerClasspath(project(":kotlin-compiler-embeddable")) - compilerClasspath(project(":kotlin-scripting-compiler-embeddable")) - compilerClasspath(project(":kotlin-scripting-compiler-impl-embeddable")) - compilerClasspath(project(":kotlin-script-runtime")) - compilerClasspath(project(":kotlin-scripting-jvm")) - compileOnly(project(":compiler:cli-common")) // TODO: fix import (workaround for jps build) - testCompileOnly(project(":core:util.runtime")) // TODO: fix import (workaround for jps build) - testCompileOnly(project(":daemon-common")) // TODO: fix import (workaround for jps build) -} - -projectTest { - dependsOn(compilerClasspath) - val compilerClasspathProvider = project.provider { compilerClasspath.asPath } - doFirst { - systemProperty("kotlin.compiler.classpath", compilerClasspathProvider.get()) - } -} diff --git a/libraries/examples/kotlin-jsr223-daemon-local-eval-example/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory b/libraries/examples/kotlin-jsr223-daemon-local-eval-example/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory deleted file mode 100644 index 1fc4404b1cd..00000000000 --- a/libraries/examples/kotlin-jsr223-daemon-local-eval-example/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory +++ /dev/null @@ -1 +0,0 @@ -org.jetbrains.kotlin.script.jsr223.KotlinJsr223JvmDaemonLocalEvalScriptEngineFactory diff --git a/libraries/examples/kotlin-jsr223-daemon-local-eval-example/src/test/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223ScriptEngineIT.kt b/libraries/examples/kotlin-jsr223-daemon-local-eval-example/src/test/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223ScriptEngineIT.kt deleted file mode 100644 index fa804740b33..00000000000 --- a/libraries/examples/kotlin-jsr223-daemon-local-eval-example/src/test/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223ScriptEngineIT.kt +++ /dev/null @@ -1,180 +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 org.jetbrains.kotlin.script.jsr223 - -import org.jetbrains.kotlin.config.KotlinCompilerVersion -import org.jetbrains.kotlin.daemon.common.threadCpuTime -import org.junit.Assert -import org.junit.Test -import java.lang.management.ManagementFactory -import java.util.concurrent.TimeUnit -import javax.script.* - -class KotlinJsr223DaemonCompileScriptEngineIT { - - @Test - fun testEngineFactory() { - val factory = ScriptEngineManager().getEngineByExtension("kts").factory - Assert.assertNotNull(factory) - factory!!.apply { - Assert.assertEquals("kotlin", languageName) - Assert.assertEquals(KotlinCompilerVersion.VERSION, languageVersion) - Assert.assertEquals("kotlin", engineName) - Assert.assertEquals(KotlinCompilerVersion.VERSION, engineVersion) - Assert.assertEquals(listOf("kts"), extensions) - Assert.assertEquals(listOf("text/x-kotlin"), mimeTypes) - Assert.assertEquals(listOf("kotlin"), names) - Assert.assertEquals("obj.method(arg1, arg2, arg3)", getMethodCallSyntax("obj", "method", "arg1", "arg2", "arg3")) - Assert.assertEquals("print(\"Hello, world!\")", getOutputStatement("Hello, world!")) - Assert.assertEquals(KotlinCompilerVersion.VERSION, getParameter(ScriptEngine.LANGUAGE_VERSION)) - val sep = System.getProperty("line.separator") - val prog = arrayOf("val x: Int = 3", "var y = x + 2") - Assert.assertEquals(prog.joinToString(sep) + sep, getProgram(*prog)) - } - } - - @Test - fun testEngine() { - val factory = ScriptEngineManager().getEngineByExtension("kts").factory - Assert.assertNotNull(factory) - val engine = factory!!.scriptEngine - Assert.assertNotNull(engine as? KotlinJsr223JvmDaemonCompileScriptEngine) - Assert.assertSame(factory, engine!!.factory) - val bindings = engine.createBindings() - Assert.assertTrue(bindings is SimpleBindings) - } - - @Test - fun testSimpleEval() { - val engine = ScriptEngineManager().getEngineByExtension("kts")!! - val res1 = engine.eval("val x = 3") - Assert.assertNull(res1) - val res2 = engine.eval("x + 2") - Assert.assertEquals(5, res2) - } - - @Test - fun testInvocable() { - val engine = ScriptEngineManager().getEngineByExtension("kts")!! - val res1 = engine.eval(""" -fun fn(x: Int) = x + 2 -val obj = object { - fun fn1(x: Int) = x + 3 -} -obj -""") - Assert.assertNotNull(res1) - val invocator = engine as? Invocable - Assert.assertNotNull(invocator) - assertThrows(NoSuchMethodException::class.java) { - invocator!!.invokeFunction("fn1", 3) - } - val res2 = invocator!!.invokeFunction("fn", 3) - Assert.assertEquals(5, res2) - // TODO: fix and restore -// assertThrows(NoSuchMethodException::class.java) { -// invocator!!.invokeMethod(res1, "fn", 3) -// } - val res3 = invocator.invokeMethod(res1, "fn1", 3) - Assert.assertEquals(6, res3) - } - - @Test - fun testEvalWithContext() { - val engine = ScriptEngineManager().getEngineByExtension("kts")!! - - engine.put("z", 33) - - engine.eval("""val x = 10 + bindings["z"] as Int""") - - val result = engine.eval("""x + 20""") - Assert.assertEquals(63, result) - - // in the current implementation the history is shared between contexts, so "x" could also be used in this line, - // but this behaviour probably will not be preserved in the future, since contexts may become completely isolated - val result2 = engine.eval("""11 + bindings["boundValue"] as Int""", engine.createBindings().apply { - put("boundValue", 100) - }) - Assert.assertEquals(111, result2) - } - - @Test - fun testSimpleEvalInEval() { - val engine = ScriptEngineManager().getEngineByExtension("kts")!! - val res1 = engine.eval("val x = 3") - Assert.assertNull(res1) - val res2 = engine.eval("val y = eval(\"\$x + 2\") as Int\ny") - Assert.assertEquals(5, res2) - val res3 = engine.eval("y + 2") - Assert.assertEquals(7, res3) - } - - @Test - fun testSimpleCompilableWithBindings() { - val engine = ScriptEngineManager().getEngineByExtension("kts") - engine.put("z", 33) - val comp = (engine as Compilable).compile("val x = 10 + bindings[\"z\"] as Int\nx + 20") - val res1 = comp.eval() - Assert.assertEquals(63, res1) - engine.put("z", 44) - val res2 = comp.eval() - Assert.assertEquals(74, res2) - } - - // Note: the test is flaky, because it is statistical and the thresholds are not big enough. - // Therefore it was decided to disable it, but leave in the code in order to be able to quickly check overheads when needed. -// @Test - fun testEvalInEvalBench() { - val engine = ScriptEngineManager().getEngineByExtension("kts")!! - - val script = "val x = 3\nx + 10" - - val mxBeans = ManagementFactory.getThreadMXBean() - - engine.eval("val bnd = createBindings()") - - val times = generateSequence { - val t0 = mxBeans.threadCpuTime() - - engine.eval(script) - val t1 = mxBeans.threadCpuTime() - - engine.eval("eval(\"\"\"$script\"\"\", bnd)") - val t2 = mxBeans.threadCpuTime() - - Triple(t1 - t0, t2 - t1, t2 - t1) - }.take(10).toList() - - val adjustedMaxDiff = times.sortedByDescending { (_, _, diff) -> diff }.drop(2).first() - - fun Long.ms() = TimeUnit.NANOSECONDS.toMillis(this) - Assert.assertTrue("eval in eval is too long: ${times.joinToString { "(${it.first.ms()}, ${it.second.ms()})" }} (expecting no more than 5x difference)", - adjustedMaxDiff.third < 10 || adjustedMaxDiff.first * 5 > adjustedMaxDiff.second ) - } -} - -fun assertThrows(exceptionClass: Class<*>, body: () -> Unit) { - try { - body() - Assert.fail("Expecting an exception of type ${exceptionClass.name}") - } - catch (e: Throwable) { - if (!exceptionClass.isAssignableFrom(e.javaClass)) { - Assert.fail("Expecting an exception of type ${exceptionClass.name} but got ${e.javaClass.name}") - } - } -} diff --git a/libraries/examples/kotlin-jsr223-local-example/build.gradle.kts b/libraries/examples/kotlin-jsr223-local-example/build.gradle.kts deleted file mode 100644 index fbb7e51607c..00000000000 --- a/libraries/examples/kotlin-jsr223-local-example/build.gradle.kts +++ /dev/null @@ -1,28 +0,0 @@ -import org.jetbrains.kotlin.pill.PillExtension - -description = "Sample Kotlin JSR 223 scripting jar with local (in-process) compilation and evaluation" - -plugins { - kotlin("jvm") - id("jps-compatible") -} - -pill { - variant = PillExtension.Variant.FULL -} - -dependencies { - api(kotlinStdlib()) - api(project(":kotlin-script-runtime")) - api(project(":kotlin-compiler-embeddable")) - api(project(":kotlin-script-util")) - runtimeOnly(project(":kotlin-scripting-compiler-embeddable")) - testApi(project(":kotlin-test:kotlin-test-junit")) - testApi(commonDependency("junit:junit")) - compileOnly(project(":compiler:cli-common")) // TODO: fix import (workaround for jps build) - testCompileOnly(project(":core:util.runtime")) // TODO: fix import (workaround for jps build) - testCompileOnly(project(":daemon-common")) // TODO: fix import (workaround for jps build) - testRuntimeOnly(project(":kotlin-scripting-compiler-embeddable")) -} - -projectTest() diff --git a/libraries/examples/kotlin-jsr223-local-example/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory b/libraries/examples/kotlin-jsr223-local-example/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory deleted file mode 100644 index b60d0efbd69..00000000000 --- a/libraries/examples/kotlin-jsr223-local-example/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory +++ /dev/null @@ -1,2 +0,0 @@ -org.jetbrains.kotlin.script.jsr223.KotlinJsr223JvmLocalScriptEngineFactory - diff --git a/libraries/examples/kotlin-jsr223-local-example/src/test/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223ScriptEngineIT.kt b/libraries/examples/kotlin-jsr223-local-example/src/test/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223ScriptEngineIT.kt deleted file mode 100644 index 9a24ada6ee3..00000000000 --- a/libraries/examples/kotlin-jsr223-local-example/src/test/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223ScriptEngineIT.kt +++ /dev/null @@ -1,259 +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 org.jetbrains.kotlin.script.jsr223 - -import org.jetbrains.kotlin.config.KotlinCompilerVersion -import org.jetbrains.kotlin.daemon.common.threadCpuTime -import org.jetbrains.kotlin.cli.common.environment.setIdeaIoUseFallback -import org.junit.Assert -import org.junit.Test -import java.lang.management.ManagementFactory -import java.util.concurrent.TimeUnit -import javax.script.* - -class KotlinJsr223LocalScriptEngineIT { - - init { - setIdeaIoUseFallback() - } - - @Test - fun testEngineFactory() { - val factory = ScriptEngineManager().getEngineByExtension("kts").factory - Assert.assertNotNull(factory) - factory!!.apply { - Assert.assertEquals("kotlin", languageName) - Assert.assertEquals(KotlinCompilerVersion.VERSION, languageVersion) - Assert.assertEquals("kotlin", engineName) - Assert.assertEquals(KotlinCompilerVersion.VERSION, engineVersion) - Assert.assertEquals(listOf("kts"), extensions) - Assert.assertEquals(listOf("text/x-kotlin"), mimeTypes) - Assert.assertEquals(listOf("kotlin"), names) - Assert.assertEquals("obj.method(arg1, arg2, arg3)", getMethodCallSyntax("obj", "method", "arg1", "arg2", "arg3")) - Assert.assertEquals("print(\"Hello, world!\")", getOutputStatement("Hello, world!")) - Assert.assertEquals(KotlinCompilerVersion.VERSION, getParameter(ScriptEngine.LANGUAGE_VERSION)) - val sep = System.getProperty("line.separator") - val prog = arrayOf("val x: Int = 3", "var y = x + 2") - Assert.assertEquals(prog.joinToString(sep) + sep, getProgram(*prog)) - } - } - - @Test - fun testEngine() { - val factory = ScriptEngineManager().getEngineByExtension("kts").factory - Assert.assertNotNull(factory) - val engine = factory!!.scriptEngine - Assert.assertNotNull(engine as? KotlinJsr223JvmLocalScriptEngine) - Assert.assertSame(factory, engine!!.factory) - val bindings = engine.createBindings() - Assert.assertTrue(bindings is SimpleBindings) - } - - @Test - fun testSimpleEval() { - val engine = ScriptEngineManager().getEngineByExtension("kts")!! - val res1 = engine.eval("val x = 3") - Assert.assertNull(res1) - val res2 = engine.eval("x + 2") - Assert.assertEquals(5, res2) - } - - @Test - fun testEvalWithError() { - val engine = ScriptEngineManager().getEngineByExtension("kts")!! - - try { - engine.eval("java.lang.fish") - Assert.fail("Script error expected") - } - catch (e: ScriptException) {} - - val res1 = engine.eval("val x = 3") - Assert.assertNull(res1) - - try { - engine.eval("y") - Assert.fail("Script error expected") - } - catch (e: ScriptException) { - Assert.assertTrue("Expected message to contain \"unresolved reference: y\", actual: \"${e.message}\"", - e.message?.contains("unresolved reference: y") ?: false) - } - - val res3 = engine.eval("x + 2") - Assert.assertEquals(5, res3) - } - - @Test - fun testEngineRepeatWithReset() { - val code = "open class A {}\n" + - "class B : A() {}" - val engine = ScriptEngineManager().getEngineByExtension("kts") as KotlinJsr223JvmLocalScriptEngine - - val res1 = engine.eval(code) - Assert.assertNull(res1) - - engine.state.history.reset() - - engine.eval(code) - } - - @Test - fun testInvocable() { - val engine = ScriptEngineManager().getEngineByExtension("kts")!! - val res1 = engine.eval(""" -fun fn(x: Int) = x + 2 -val obj = object { - fun fn1(x: Int) = x + 3 -} -obj -""") - Assert.assertNotNull(res1) - val invocator = engine as? Invocable - Assert.assertNotNull(invocator) - assertThrows(NoSuchMethodException::class.java) { - invocator!!.invokeFunction("fn1", 3) - } - val res2 = invocator!!.invokeFunction("fn", 3) - Assert.assertEquals(5, res2) - // TODO: fix and restore -// assertThrows(NoSuchMethodException::class.java) { -// invocator!!.invokeMethod(res1, "fn", 3) -// } - val res3 = invocator.invokeMethod(res1, "fn1", 3) - Assert.assertEquals(6, res3) - } - - @Test - fun testSimpleCompilable() { - val engine = ScriptEngineManager().getEngineByExtension("kts") as KotlinJsr223JvmLocalScriptEngine - val comp1 = engine.compile("val x = 3") - val comp2 = engine.compile("x + 2") - val res1 = comp1.eval() - Assert.assertNull(res1) - val res2 = comp2.eval() - Assert.assertEquals(5, res2) - } - - @Test - fun testMultipleCompilable() { - val engine = ScriptEngineManager().getEngineByExtension("kts") as KotlinJsr223JvmLocalScriptEngine - val compiled1 = engine.compile("""listOf(1,2,3).joinToString(",")""") - val compiled2 = engine.compile("""val x = bindings["boundValue"] as Int + bindings["z"] as Int""") - val compiled3 = engine.compile("""x""") - - Assert.assertEquals("1,2,3", compiled1.eval()) - Assert.assertEquals("1,2,3", compiled1.eval()) - Assert.assertEquals("1,2,3", compiled1.eval()) - Assert.assertEquals("1,2,3", compiled1.eval()) - - engine.getBindings(ScriptContext.ENGINE_SCOPE).apply { - put("boundValue", 100) - put("z", 33) - } - - compiled2.eval() - - Assert.assertEquals(133, compiled3.eval()) - Assert.assertEquals(133, compiled3.eval()) - Assert.assertEquals(133, compiled3.eval()) - } - - @Test - fun testEvalWithContext() { - val engine = ScriptEngineManager().getEngineByExtension("kts")!! - - engine.put("z", 33) - - engine.eval("""val x = 10 + bindings["z"] as Int""") - - val result = engine.eval("""x + 20""") - Assert.assertEquals(63, result) - - // in the current implementation the history is shared between contexts, so "x" could also be used in this line, - // but this behaviour probably will not be preserved in the future, since contexts may become completely isolated - val result2 = engine.eval("""11 + bindings["boundValue"] as Int""", engine.createBindings().apply { - put("boundValue", 100) - }) - Assert.assertEquals(111, result2) - } - - @Test - fun testSimpleEvalInEval() { - val engine = ScriptEngineManager().getEngineByExtension("kts")!! - val res1 = engine.eval("val x = 3") - Assert.assertNull(res1) - val res2 = engine.eval("val y = eval(\"\$x + 2\") as Int\ny") - Assert.assertEquals(5, res2) - val res3 = engine.eval("y + 2") - Assert.assertEquals(7, res3) - } - - // Note: the test is flaky, because it is statistical and the thresholds are not big enough. - // Therefore it was decided to disable it, but leave in the code in order to be able to quickly check overheads when needed. -// @Test - fun testEvalInEvalBench() { - val engine = ScriptEngineManager().getEngineByExtension("kts")!! - - val script = "val x = 3\nx + 10" - - val mxBeans = ManagementFactory.getThreadMXBean() - - engine.eval("val bnd = createBindings()") - - val times = generateSequence { - val t0 = mxBeans.threadCpuTime() - - engine.eval(script) - val t1 = mxBeans.threadCpuTime() - - engine.eval("eval(\"\"\"$script\"\"\", bnd)") - val t2 = mxBeans.threadCpuTime() - - Triple(t1 - t0, t2 - t1, t2 - t1) - }.take(10).toList() - - val adjustedMaxDiff = times.sortedByDescending { (_, _, diff) -> diff }.drop(2).first() - - fun Long.ms() = TimeUnit.NANOSECONDS.toMillis(this) - Assert.assertTrue("eval in eval is too long: ${times.joinToString { "(${it.first.ms()}, ${it.second.ms()})" }} (expecting no more than 5x difference)", - adjustedMaxDiff.third < 20 /* assuming it measurement error */ || adjustedMaxDiff.first * 5 > adjustedMaxDiff.second ) - } - - @Test - fun `kotlin script evaluation should support functional return types`() { - val scriptEngine = KotlinJsr223JvmLocalScriptEngineFactory().scriptEngine - - val script = "{1 + 2}" - val result = scriptEngine.eval(script) - - Assert.assertTrue(result is Function0<*>) - Assert.assertEquals(3, (result as Function0<*>).invoke()) - } -} - -fun assertThrows(exceptionClass: Class<*>, body: () -> Unit) { - try { - body() - Assert.fail("Expecting an exception of type ${exceptionClass.name}") - } - catch (e: Throwable) { - if (!exceptionClass.isAssignableFrom(e.javaClass)) { - Assert.fail("Expecting an exception of type ${exceptionClass.name} but got ${e.javaClass.name}") - } - } -} diff --git a/libraries/examples/scripting/jvm-simple-script/host/build.gradle.kts b/libraries/examples/scripting/jvm-simple-script/host/build.gradle.kts index 3106ee0339b..4ea150c9fe0 100644 --- a/libraries/examples/scripting/jvm-simple-script/host/build.gradle.kts +++ b/libraries/examples/scripting/jvm-simple-script/host/build.gradle.kts @@ -6,7 +6,6 @@ plugins { dependencies { api(project(":examples:scripting-jvm-simple-script")) api(project(":kotlin-scripting-jvm-host-unshaded")) - api(project(":kotlin-script-util")) testRuntimeOnly(project(":kotlin-compiler")) testRuntimeOnly(project(":kotlin-scripting-compiler")) testApi(commonDependency("junit")) diff --git a/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223JvmDaemonCompileScriptEngine.kt b/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223JvmDaemonCompileScriptEngine.kt index 5c65a02665b..762d5cb00f7 100644 --- a/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223JvmDaemonCompileScriptEngine.kt +++ b/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223JvmDaemonCompileScriptEngine.kt @@ -35,6 +35,7 @@ import kotlin.reflect.KClass // TODO: need to manage resources here, i.e. call replCompiler.dispose when engine is collected +@Deprecated("Use kotlin-scripting-jsr223 instead") class KotlinJsr223JvmDaemonCompileScriptEngine( factory: ScriptEngineFactory, compilerClasspath: List, diff --git a/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223JvmLocalScriptEngine.kt b/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223JvmLocalScriptEngine.kt index c3bd0f5ba5f..18e5e257534 100644 --- a/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223JvmLocalScriptEngine.kt +++ b/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223JvmLocalScriptEngine.kt @@ -38,6 +38,7 @@ import javax.script.ScriptContext import javax.script.ScriptEngineFactory import kotlin.reflect.KClass +@Deprecated("Use kotlin-scripting-jsr223 instead") class KotlinJsr223JvmLocalScriptEngine( factory: ScriptEngineFactory, val templateClasspath: List, diff --git a/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223ScriptEngineFactoryExamples.kt b/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223ScriptEngineFactoryExamples.kt index bc8d33d1da5..bfbce70e888 100644 --- a/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223ScriptEngineFactoryExamples.kt +++ b/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223ScriptEngineFactoryExamples.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -@file:Suppress("unused") // could be used externally in javax.script.ScriptEngineFactory META-INF file +@file:Suppress("unused", "DEPRECATION") // could be used externally in javax.script.ScriptEngineFactory META-INF file package org.jetbrains.kotlin.script.jsr223 @@ -26,6 +26,7 @@ import javax.script.ScriptEngine import kotlin.script.experimental.jvm.util.KotlinJars import kotlin.script.experimental.jvm.util.scriptCompilationClasspathFromContext +@Deprecated("Use kotlin-scripting-jsr223 instead") class KotlinJsr223JvmLocalScriptEngineFactory : KotlinJsr223JvmScriptEngineFactoryBase() { override fun getScriptEngine(): ScriptEngine = @@ -38,6 +39,7 @@ class KotlinJsr223JvmLocalScriptEngineFactory : KotlinJsr223JvmScriptEngineFacto ) } +@Deprecated("Use kotlin-scripting-jsr223 instead") class KotlinJsr223JvmDaemonLocalEvalScriptEngineFactory : KotlinJsr223JvmScriptEngineFactoryBase() { override fun getScriptEngine(): ScriptEngine = diff --git a/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinStandardJsr223ScriptTemplate.kt b/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinStandardJsr223ScriptTemplate.kt index 03a216eb430..df789fbe237 100644 --- a/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinStandardJsr223ScriptTemplate.kt +++ b/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinStandardJsr223ScriptTemplate.kt @@ -9,6 +9,7 @@ import kotlin.script.templates.standard.ScriptTemplateWithBindings @Suppress("unused") @ScriptTemplateDefinition +@Deprecated("Use kotlin-scripting-jsr223 instead") abstract class KotlinStandardJsr223ScriptTemplate(val jsr223Bindings: Bindings) : ScriptTemplateWithBindings(jsr223Bindings) { private val myEngine: ScriptEngine? get() = bindings[KOTLIN_SCRIPT_ENGINE_BINDINGS_KEY]?.let { it as? ScriptEngine } diff --git a/settings.gradle b/settings.gradle index 80d9296123a..7a372b85544 100644 --- a/settings.gradle +++ b/settings.gradle @@ -226,8 +226,6 @@ include ":kotlin-imports-dumper-compiler-plugin", ":kotlin-annotation-processing-runtime", ":kotlin-annotation-processing-embeddable", ":kotlin-daemon-embeddable", - ":examples:kotlin-jsr223-local-example", - ":examples:kotlin-jsr223-daemon-local-eval-example", ":kotlin-annotations-jvm", ":kotlin-scripting-common", ":kotlin-scripting-jvm", @@ -751,8 +749,6 @@ project(':kotlin-annotation-processing').projectDir = "$rootDir/plugins/kapt3/ka project(':kotlin-annotation-processing-cli').projectDir = "$rootDir/plugins/kapt3/kapt3-cli" as File project(':kotlin-annotation-processing-base').projectDir = "$rootDir/plugins/kapt3/kapt3-base" as File project(':kotlin-annotation-processing-runtime').projectDir = "$rootDir/plugins/kapt3/kapt3-runtime" as File -project(':examples:kotlin-jsr223-local-example').projectDir = "$rootDir/libraries/examples/kotlin-jsr223-local-example" as File -project(':examples:kotlin-jsr223-daemon-local-eval-example').projectDir = "$rootDir/libraries/examples/kotlin-jsr223-daemon-local-eval-example" as File project(':kotlin-annotations-jvm').projectDir = "$rootDir/libraries/tools/kotlin-annotations-jvm" as File project(':kotlin-scripting-common').projectDir = "$rootDir/libraries/scripting/common" as File project(':kotlin-scripting-jvm').projectDir = "$rootDir/libraries/scripting/jvm" as File