diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CompileEnvironmentUtil.java b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CompileEnvironmentUtil.java index 83ee3250f2a..a964d4b6b65 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CompileEnvironmentUtil.java +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CompileEnvironmentUtil.java @@ -118,16 +118,11 @@ public class CompileEnvironmentUtil { } private static void writeRuntimeToJar(JarOutputStream stream) throws IOException { - File runtimePath = PathUtil.getKotlinPathsForCompiler().getRuntimePath(); - if (!runtimePath.exists()) { - throw new CompileEnvironmentException("Couldn't find runtime library"); + File stdlibPath = PathUtil.getKotlinPathsForCompiler().getStdlibPath(); + if (!stdlibPath.exists()) { + throw new CompileEnvironmentException("Couldn't find kotlin-stdlib at " + stdlibPath); } - File scriptRuntimePath = PathUtil.getKotlinPathsForCompiler().getScriptRuntimePath(); - if (!scriptRuntimePath.exists()) { - throw new CompileEnvironmentException("Couldn't find script runtime library"); - } - - copyJarImpl(stream, runtimePath); + copyJarImpl(stream, stdlibPath); } private static void copyJarImpl(JarOutputStream stream, File jarPath) throws IOException { diff --git a/compiler/testData/script/fib_ext_ann.kts b/compiler/testData/script/fib_ext_ann.kts index e36189a4b38..8df7ebfd1b4 100644 --- a/compiler/testData/script/fib_ext_ann.kts +++ b/compiler/testData/script/fib_ext_ann.kts @@ -1,7 +1,7 @@ // this script expected parameter num : Int -@file:DependsOn("@{runtime}") +@file:DependsOn("@{kotlin-stdlib}") fun fib(n: Int): Int { val v = if(n < 2) 1 else fib(n-1) + fib(n-2) diff --git a/compiler/testData/script/fib_ext_ann2.kts b/compiler/testData/script/fib_ext_ann2.kts index d6ce39efeaa..fd333feacf8 100644 --- a/compiler/testData/script/fib_ext_ann2.kts +++ b/compiler/testData/script/fib_ext_ann2.kts @@ -1,7 +1,7 @@ // this script expected parameter num : Int -@file:DependsOnTwo(path2 = "@{runtime}") +@file:DependsOnTwo(path2 = "@{kotlin-stdlib}") fun fib(n: Int): Int { val v = if(n < 2) 1 else fib(n-1) + fib(n-2) diff --git a/compiler/testData/script/smoke_exception.kts b/compiler/testData/script/smoke_exception.kts index 85ff1c42c76..ede23cf0190 100644 --- a/compiler/testData/script/smoke_exception.kts +++ b/compiler/testData/script/smoke_exception.kts @@ -1,4 +1,4 @@ -@file:DependsOn("@{runtime}") +@file:DependsOn("@{kotlin-stdlib}") fun main() { error("my error") @@ -8,4 +8,4 @@ fun a() { main() } -a() \ No newline at end of file +a() diff --git a/compiler/tests/org/jetbrains/kotlin/scripts/ScriptTemplateTest.kt b/compiler/tests/org/jetbrains/kotlin/scripts/ScriptTemplateTest.kt index 936bb82c2c5..270d538c6c2 100644 --- a/compiler/tests/org/jetbrains/kotlin/scripts/ScriptTemplateTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/scripts/ScriptTemplateTest.kt @@ -401,22 +401,21 @@ open class TestKotlinScriptDependenciesResolver : TestKotlinScriptDummyDependenc private val kotlinPaths by lazy { PathUtil.kotlinPathsForCompiler } @AcceptedAnnotations(DependsOn::class, DependsOnTwo::class) - override fun resolve(scriptContents: ScriptContents, - environment: Environment - ): ResolveResult - { - val cp = scriptContents.annotations.flatMap { - when (it) { - is DependsOn -> if (it.path == "@{runtime}") listOf(kotlinPaths.runtimePath, kotlinPaths.scriptRuntimePath) else listOf(File(it.path)) - is DependsOnTwo -> listOf(it.path1, it.path2).flatMap { + override fun resolve(scriptContents: ScriptContents, environment: Environment): ResolveResult { + val cp = scriptContents.annotations.flatMap { annotation -> + when (annotation) { + is DependsOn -> + if (annotation.path == "@{kotlin-stdlib}") listOf(kotlinPaths.stdlibPath, kotlinPaths.scriptRuntimePath) + else listOf(File(annotation.path)) + is DependsOnTwo -> listOf(annotation.path1, annotation.path2).flatMap { when { it.isBlank() -> emptyList() - it == "@{runtime}" -> listOf(kotlinPaths.runtimePath, kotlinPaths.scriptRuntimePath) + it == "@{kotlin-stdlib}" -> listOf(kotlinPaths.stdlibPath, kotlinPaths.scriptRuntimePath) else -> listOf(File(it)) } } - is InvalidScriptResolverAnnotation -> throw Exception("Invalid annotation ${it.name}", it.error) - else -> throw Exception("Unknown annotation ${it::class.java}") + is InvalidScriptResolverAnnotation -> throw Exception("Invalid annotation ${annotation.name}", annotation.error) + else -> throw Exception("Unknown annotation ${annotation::class.java}") } } return ScriptDependencies( diff --git a/compiler/util/src/org/jetbrains/kotlin/utils/KotlinPaths.java b/compiler/util/src/org/jetbrains/kotlin/utils/KotlinPaths.java index e3a5611ba2f..1ff38739dbe 100644 --- a/compiler/util/src/org/jetbrains/kotlin/utils/KotlinPaths.java +++ b/compiler/util/src/org/jetbrains/kotlin/utils/KotlinPaths.java @@ -27,12 +27,6 @@ public interface KotlinPaths { @NotNull File getLibPath(); - /** - * @deprecated Use getStdlibPath() instead - */ - @NotNull - File getRuntimePath(); - @NotNull File getStdlibPath(); diff --git a/compiler/util/src/org/jetbrains/kotlin/utils/KotlinPathsFromHomeDir.java b/compiler/util/src/org/jetbrains/kotlin/utils/KotlinPathsFromHomeDir.java index debdded57da..4fcef768d58 100644 --- a/compiler/util/src/org/jetbrains/kotlin/utils/KotlinPathsFromHomeDir.java +++ b/compiler/util/src/org/jetbrains/kotlin/utils/KotlinPathsFromHomeDir.java @@ -40,12 +40,6 @@ public class KotlinPathsFromHomeDir implements KotlinPaths { return new File(homePath, "lib"); } - @Override - @NotNull - public File getRuntimePath() { - return getLibraryFile(PathUtil.KOTLIN_JAVA_RUNTIME_JAR); - } - @NotNull @Override public File getStdlibPath() { diff --git a/compiler/util/src/org/jetbrains/kotlin/utils/PathUtil.kt b/compiler/util/src/org/jetbrains/kotlin/utils/PathUtil.kt index 067fe7f6bbc..a19987e5b4c 100644 --- a/compiler/util/src/org/jetbrains/kotlin/utils/PathUtil.kt +++ b/compiler/util/src/org/jetbrains/kotlin/utils/PathUtil.kt @@ -30,7 +30,6 @@ object PathUtil { const val NOARG_PLUGIN_JAR_NAME = "noarg-compiler-plugin.jar" const val SAM_WITH_RECEIVER_PLUGIN_JAR_NAME = "sam-with-receiver-compiler-plugin.jar" const val JS_LIB_SRC_JAR_NAME = "kotlin-stdlib-js-sources.jar" - const val KOTLIN_JAVA_RUNTIME_JAR = "kotlin-runtime.jar" const val KOTLIN_JAVA_RUNTIME_JRE7_JAR = "kotlin-stdlib-jre7.jar" const val KOTLIN_JAVA_RUNTIME_JRE8_JAR = "kotlin-stdlib-jre8.jar" const val KOTLIN_JAVA_RUNTIME_JRE7_SRC_JAR = "kotlin-stdlib-jre7-sources.jar" diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt index dafc8e5d280..5ec059214e0 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt @@ -177,7 +177,7 @@ abstract class AbstractConfigureKotlinTest : PlatformTestCase() { private val pathToNonexistentRuntimeJar: String get() { - val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/" + PathUtil.KOTLIN_JAVA_RUNTIME_JAR + val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/kotlin-runtime.jar" PlatformTestCase.myFilesToDelete.add(File(pathToTempKotlinRuntimeJar)) return pathToTempKotlinRuntimeJar } diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jvm/compiler/ClasspathOrderTest.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jvm/compiler/ClasspathOrderTest.kt index f5d416aae90..5a67cbce68f 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jvm/compiler/ClasspathOrderTest.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jvm/compiler/ClasspathOrderTest.kt @@ -32,7 +32,7 @@ import java.io.File */ class ClasspathOrderTest : TestCaseWithTmpdir() { companion object { - val sourceDir = File(KotlinTestUtils.getTestDataPathBase() + "/classpathOrder").absoluteFile + private val sourceDir = File(KotlinTestUtils.getTestDataPathBase() + "/classpathOrder").absoluteFile } fun testClasspathOrderForCLI() { @@ -45,7 +45,7 @@ class ClasspathOrderTest : TestCaseWithTmpdir() { File(tmpdir, "output").absolutePath, listOf(sourceDir), listOf(JvmSourceRoot(sourceDir)), - listOf(PathUtil.kotlinPathsForDistDirectory.runtimePath), + listOf(PathUtil.kotlinPathsForDistDirectory.stdlibPath), null, JavaModuleBuildTargetType.PRODUCTION.typeId, JavaModuleBuildTargetType.PRODUCTION.isTests,