diff --git a/build.xml b/build.xml index 1b8095a042f..3720b2bc66d 100644 --- a/build.xml +++ b/build.xml @@ -15,7 +15,13 @@ - + + + + + @@ -23,6 +29,7 @@ + @@ -50,8 +57,8 @@ little to no differences between the new and the newest runtime. --> + value="kotlin-runtime-internal-bootstrap.jar kotlin-reflect-internal-bootstrap.jar" + else="kotlin-runtime.jar kotlin-reflect.jar"> @@ -541,7 +548,7 @@ -libraryjars '${rtjar}' -libraryjars '${jssejar}' - -libraryjars '${bootstrap.runtime.minimal}' + -libraryjars '${bootstrap.runtime}' -target 1.6 -dontoptimize @@ -625,6 +632,7 @@ + @@ -783,6 +791,25 @@ + + + + + + + + + + + + + + + + + + + @@ -791,81 +818,78 @@ + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - + + - - + + + + + - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - + + + + + + + + depends="builtins,stdlib,core,reflection,pack-runtime,pack-runtime-sources"/> classpath = new ArrayList(); classpath.add(ForTestCompileRuntime.runtimeJarForTests().getPath()); + classpath.add(ForTestCompileRuntime.reflectJarForTests().getPath()); classpath.add(JetTestUtils.getAnnotationsJar().getPath()); classpath.addAll(Arrays.asList(additionalClasspath)); List options = Arrays.asList( diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/forTestCompile/ForTestCompileRuntime.java b/compiler/tests/org/jetbrains/kotlin/codegen/forTestCompile/ForTestCompileRuntime.java index c43665e5926..148cce29597 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/forTestCompile/ForTestCompileRuntime.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/forTestCompile/ForTestCompileRuntime.java @@ -31,11 +31,20 @@ public class ForTestCompileRuntime { @NotNull public static File runtimeJarForTests() { - File runtime = new File("dist/kotlinc/lib/kotlin-runtime.jar"); - if (!runtime.exists()) { - throw new IllegalStateException("kotlin-runtime.jar in dist/kotlinc/lib does not exist. Run 'ant dist'"); + return assertExists(new File("dist/kotlinc/lib/kotlin-runtime.jar")); + } + + @NotNull + public static File reflectJarForTests() { + return assertExists(new File("dist/kotlinc/lib/kotlin-reflect.jar")); + } + + @NotNull + private static File assertExists(@NotNull File file) { + if (!file.exists()) { + throw new IllegalStateException(file + " does not exist. Run 'ant dist'"); } - return runtime; + return file; } @NotNull @@ -43,7 +52,10 @@ public class ForTestCompileRuntime { ClassLoader loader = runtimeJarClassLoader.get(); if (loader == null) { try { - loader = new URLClassLoader(new URL[] {runtimeJarForTests().toURI().toURL()}, null); + loader = new URLClassLoader(new URL[] { + runtimeJarForTests().toURI().toURL(), + reflectJarForTests().toURI().toURL() + }, null); } catch (MalformedURLException e) { throw rethrow(e); diff --git a/compiler/tests/org/jetbrains/kotlin/integration/AntTaskJvmTest.java b/compiler/tests/org/jetbrains/kotlin/integration/AntTaskJvmTest.java index 8ce28c4420c..c7415e43c87 100644 --- a/compiler/tests/org/jetbrains/kotlin/integration/AntTaskJvmTest.java +++ b/compiler/tests/org/jetbrains/kotlin/integration/AntTaskJvmTest.java @@ -17,6 +17,7 @@ package org.jetbrains.kotlin.integration; import org.jetbrains.annotations.NotNull; +import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime; import org.jetbrains.kotlin.utils.UtilsPackage; import org.junit.Rule; import org.junit.Test; @@ -40,16 +41,20 @@ public class AntTaskJvmTest extends AntTaskBaseTest { private void doJvmAntTest(String... extraJavaArgs) throws Exception { doAntTest(SUCCESSFUL, extraJavaArgs); - String jar = getOutputFileByName(JVM_OUT_FILE).getAbsolutePath(); + String classpath = UtilsPackage.join(Arrays.asList( + getOutputFileByName(JVM_OUT_FILE).getAbsolutePath(), + ForTestCompileRuntime.runtimeJarForTests().getAbsolutePath(), + ForTestCompileRuntime.reflectJarForTests().getAbsolutePath() + ), File.pathSeparator); - runJava("hello.run", "-cp", jar + File.pathSeparator + getKotlinRuntimePath(), "hello.HelloPackage"); + runJava("hello.run", "-cp", classpath, "hello.HelloPackage"); } private static String getClassPathForAnt() { return UtilsPackage.join(Arrays.asList( getCompilerLib() + File.separator + "kotlin-ant.jar", getCompilerLib() + File.separator + "kotlin-compiler.jar", - getKotlinRuntimePath() + ForTestCompileRuntime.runtimeJarForTests().getAbsolutePath() ), File.pathSeparator); } diff --git a/compiler/tests/org/jetbrains/kotlin/integration/CompilerSmokeTest.java b/compiler/tests/org/jetbrains/kotlin/integration/CompilerSmokeTest.java index f6756a6a993..de38e56c669 100644 --- a/compiler/tests/org/jetbrains/kotlin/integration/CompilerSmokeTest.java +++ b/compiler/tests/org/jetbrains/kotlin/integration/CompilerSmokeTest.java @@ -18,12 +18,15 @@ package org.jetbrains.kotlin.integration; import com.intellij.util.ArrayUtil; import org.jetbrains.annotations.NotNull; +import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime; +import org.jetbrains.kotlin.utils.UtilsPackage; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -40,13 +43,16 @@ public class CompilerSmokeTest extends KotlinIntegrationTestBase { } private int runCompiler(String logName, String... arguments) throws Exception { - String classpath = getCompilerLib().getAbsolutePath() + File.separator + "kotlin-compiler.jar" + File.pathSeparator + - getKotlinRuntimePath(); - Collection javaArgs = new ArrayList(); + javaArgs.add("-cp"); - javaArgs.add(classpath); + javaArgs.add(UtilsPackage.join(Arrays.asList( + getCompilerLib().getAbsolutePath() + File.separator + "kotlin-compiler.jar", + ForTestCompileRuntime.runtimeJarForTests().getAbsolutePath(), + ForTestCompileRuntime.reflectJarForTests().getAbsolutePath() + ), File.pathSeparator)); javaArgs.add("org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"); + Collections.addAll(javaArgs, arguments); return runJava(logName, ArrayUtil.toStringArray(javaArgs)); @@ -81,7 +87,8 @@ public class CompilerSmokeTest extends KotlinIntegrationTestBase { String jar = tmpdir.getTmpDir().getAbsolutePath() + File.separator + "smoke.jar"; assertEquals("compilation failed", 0, runCompiler("Smoke.compile", "-module", "Smoke.ktm", "-d", jar)); - runJava("Smoke.run", "-cp", jar + File.pathSeparator + getKotlinRuntimePath(), "Smoke.SmokePackage", "1", "2", "3"); + String classpath = jar + File.pathSeparator + ForTestCompileRuntime.runtimeJarForTests().getAbsolutePath(); + runJava("Smoke.run", "-cp", classpath, "Smoke.SmokePackage", "1", "2", "3"); } @Test diff --git a/compiler/tests/org/jetbrains/kotlin/integration/KotlinIntegrationTestBase.java b/compiler/tests/org/jetbrains/kotlin/integration/KotlinIntegrationTestBase.java index f95c12cf957..70aa8e258c3 100644 --- a/compiler/tests/org/jetbrains/kotlin/integration/KotlinIntegrationTestBase.java +++ b/compiler/tests/org/jetbrains/kotlin/integration/KotlinIntegrationTestBase.java @@ -31,7 +31,6 @@ import kotlin.KotlinPackage; import org.intellij.lang.annotations.Language; import org.jetbrains.annotations.NotNull; import org.jetbrains.kotlin.cli.common.KotlinVersion; -import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime; import org.jetbrains.kotlin.test.JetTestUtils; import org.jetbrains.kotlin.test.Tmpdir; import org.jetbrains.kotlin.utils.PathUtil; @@ -166,10 +165,6 @@ public abstract class KotlinIntegrationTestBase { return file; } - protected static String getKotlinRuntimePath() { - return ForTestCompileRuntime.runtimeJarForTests().getAbsolutePath(); - } - protected static File getKotlinProjectHome() { return new File(PathManager.getHomePath()).getParentFile(); } diff --git a/compiler/tests/org/jetbrains/kotlin/test/JetTestUtils.java b/compiler/tests/org/jetbrains/kotlin/test/JetTestUtils.java index a9336371405..ea1fac069d7 100644 --- a/compiler/tests/org/jetbrains/kotlin/test/JetTestUtils.java +++ b/compiler/tests/org/jetbrains/kotlin/test/JetTestUtils.java @@ -385,14 +385,21 @@ public class JetTestUtils { } @NotNull - public static CompilerConfiguration compilerConfigurationForTests(@NotNull ConfigurationKind configurationKind, - @NotNull TestJdkKind jdkKind, File... extraClasspath) { + public static CompilerConfiguration compilerConfigurationForTests( + @NotNull ConfigurationKind configurationKind, + @NotNull TestJdkKind jdkKind, + @NotNull File... extraClasspath + ) { return compilerConfigurationForTests(configurationKind, jdkKind, Arrays.asList(extraClasspath), Collections.emptyList()); } @NotNull - public static CompilerConfiguration compilerConfigurationForTests(@NotNull ConfigurationKind configurationKind, - @NotNull TestJdkKind jdkKind, @NotNull Collection extraClasspath, @NotNull Collection priorityClasspath) { + public static CompilerConfiguration compilerConfigurationForTests( + @NotNull ConfigurationKind configurationKind, + @NotNull TestJdkKind jdkKind, + @NotNull Collection extraClasspath, + @NotNull Collection priorityClasspath + ) { CompilerConfiguration configuration = new CompilerConfiguration(); configuration.addAll(CLASSPATH_KEY, priorityClasspath); if (jdkKind == TestJdkKind.MOCK_JDK) { @@ -406,13 +413,15 @@ public class JetTestUtils { } if (configurationKind == ALL) { configuration.add(CLASSPATH_KEY, ForTestCompileRuntime.runtimeJarForTests()); + configuration.add(CLASSPATH_KEY, ForTestCompileRuntime.reflectJarForTests()); } configuration.addAll(CLASSPATH_KEY, extraClasspath); if (configurationKind == ALL || configurationKind == JDK_AND_ANNOTATIONS) { if (jdkKind == TestJdkKind.ANDROID_API) { configuration.add(ANNOTATIONS_PATH_KEY, getAndroidSdkAnnotationsJar()); - } else { + } + else { configuration.add(ANNOTATIONS_PATH_KEY, getJdkAnnotationsJar()); } } diff --git a/core/runtime.jvm/src/kotlin/jvm/KotlinReflectionNotSupportedError.java b/core/runtime.jvm/src/kotlin/jvm/KotlinReflectionNotSupportedError.java index 9cf69482e06..c6ae745a1d9 100644 --- a/core/runtime.jvm/src/kotlin/jvm/KotlinReflectionNotSupportedError.java +++ b/core/runtime.jvm/src/kotlin/jvm/KotlinReflectionNotSupportedError.java @@ -18,7 +18,6 @@ package kotlin.jvm; public class KotlinReflectionNotSupportedError extends Error { public KotlinReflectionNotSupportedError() { - super("Kotlin reflection implementation is not found at runtime. " + - "Make sure you do have kotlin-runtime.jar and do not have kotlin-runtime-minimal.jar in the classpath"); + super("Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath"); } } diff --git a/libraries/pom.xml b/libraries/pom.xml index cac8c027cd5..3325e2c8a15 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -45,6 +45,7 @@ 3.3.1 dart-r3300 11.0.2 + 2.5.0 4.11 0.2.3.8 ${project-root}/dist diff --git a/libraries/tools/kotlin-reflect/pom.xml b/libraries/tools/kotlin-reflect/pom.xml index 5267871b1e0..82474599e56 100644 --- a/libraries/tools/kotlin-reflect/pom.xml +++ b/libraries/tools/kotlin-reflect/pom.xml @@ -21,6 +21,16 @@ kotlin-stdlib ${project.version} + + com.google.protobuf + protobuf-java + ${protobuf.version} + + + javax.inject + javax.inject + 1 + @@ -40,7 +50,13 @@ + + + + + + diff --git a/resources/kotlinManifest.properties b/resources/kotlinManifest.properties index 5792eec70a4..6b68b3bd67c 100644 --- a/resources/kotlinManifest.properties +++ b/resources/kotlinManifest.properties @@ -7,9 +7,8 @@ manifest.impl.title.kotlin.compiler.sources=Kotlin Compiler Sources manifest.impl.title.kotlin.compiler.ant.task=Kotlin Compiler Ant Tasks manifest.impl.title.kotlin.jvm.runtime=Kotlin Runtime -manifest.impl.title.kotlin.jvm.runtime.minimal=Kotlin Runtime Minimal +manifest.impl.title.kotlin.jvm.reflect=Kotlin Reflect manifest.impl.title.kotlin.jvm.runtime.sources=Kotlin Runtime Sources -manifest.impl.title.kotlin.jvm.runtime.minimal.sources=Kotlin Runtime Minimal Sources manifest.impl.title.kotlin.javascript.stdlib=Kotlin JavaScript StdLib manifest.spec.title.kotlin.javascript.lib=Kotlin JavaScript Lib