Add mock runtime to diagnostic tests.
Mock runtime contains function from file Standard.kt
This commit is contained in:
@@ -1051,7 +1051,7 @@
|
|||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="runtime"
|
<target name="runtime"
|
||||||
depends="builtins,stdlib,kotlin-test,core,reflection,pack-runtime,pack-runtime-sources"/>
|
depends="builtins,stdlib,kotlin-test,core,reflection,pack-runtime,pack-runtime-sources,mock-runtime-for-test"/>
|
||||||
|
|
||||||
<target name="dist"
|
<target name="dist"
|
||||||
depends="clean,init,prepare-dist,preloader,runner,serialize-builtins,compiler,compiler-sources,kotlin-build,ant-tools,jdk-annotations,android-sdk-annotations,runtime,kotlin-js-stdlib,android-compiler-plugin,daemon-client"
|
depends="clean,init,prepare-dist,preloader,runner,serialize-builtins,compiler,compiler-sources,kotlin-build,ant-tools,jdk-annotations,android-sdk-annotations,runtime,kotlin-js-stdlib,android-compiler-plugin,daemon-client"
|
||||||
@@ -1150,6 +1150,27 @@
|
|||||||
</zip>
|
</zip>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="mock-runtime-for-test">
|
||||||
|
<delete dir="${output}/mock-runtime-src" failonerror="false"/>
|
||||||
|
<mkdir dir="${output}/mock-runtime-src"/>
|
||||||
|
<copy file="${basedir}/libraries/stdlib/src/kotlin/util/Standard.kt" todir="${output}/mock-runtime-src"/>
|
||||||
|
|
||||||
|
<new-kotlinc output="${output}/classes/mock-runtime" moduleName="kotlin-stdlib">
|
||||||
|
<src>
|
||||||
|
<include name="dist/mock-runtime-src"/>
|
||||||
|
</src>
|
||||||
|
<class-path>
|
||||||
|
<pathelement path="${output}/classes/builtins"/>
|
||||||
|
</class-path>
|
||||||
|
</new-kotlinc>
|
||||||
|
|
||||||
|
<pack-runtime-jar jar-dir="${output}" jar-name="kotlin-mock-runtime-for-test.jar" implementation-title="Kotlin Mock Runtime">
|
||||||
|
<jar-content>
|
||||||
|
<fileset dir="${output}/classes/mock-runtime"/>
|
||||||
|
</jar-content>
|
||||||
|
</pack-runtime-jar>
|
||||||
|
</target>
|
||||||
|
|
||||||
<target name="build-bootstrap-artifacts" depends="dist,zip-compiler"/>
|
<target name="build-bootstrap-artifacts" depends="dist,zip-compiler"/>
|
||||||
|
|
||||||
<target name="build-artifacts" depends="dist,zip-compiler,kotlin-for-upsource,zip-test-data"/>
|
<target name="build-artifacts" depends="dist,zip-compiler,kotlin-for-upsource,zip-test-data"/>
|
||||||
|
|||||||
+2
-2
@@ -6,8 +6,8 @@ public fun run(/*0*/ f: () -> kotlin.Unit): kotlin.Int
|
|||||||
public final class My {
|
public final class My {
|
||||||
public constructor My()
|
public constructor My()
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public final fun foo(/*0*/ arg: kotlin.Int?): kotlin.Int
|
public final fun foo(/*0*/ arg: kotlin.Int?): kotlin.Unit
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
public final fun kotlin.Int?.bar(): kotlin.Int
|
public final fun kotlin.Int?.bar(): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public abstract class KotlinMultiFileTestWithWithJava<M, F> extends KotlinLiteFi
|
|||||||
@NotNull
|
@NotNull
|
||||||
protected CompilerConfiguration createCompilerConfiguration(File javaFilesDir) {
|
protected CompilerConfiguration createCompilerConfiguration(File javaFilesDir) {
|
||||||
return KotlinTestUtils.compilerConfigurationForTests(
|
return KotlinTestUtils.compilerConfigurationForTests(
|
||||||
ConfigurationKind.JDK_ONLY,
|
ConfigurationKind.MOCK_RUNTIME,
|
||||||
TestJdkKind.MOCK_JDK,
|
TestJdkKind.MOCK_JDK,
|
||||||
Collections.singletonList(KotlinTestUtils.getAnnotationsJar()),
|
Collections.singletonList(KotlinTestUtils.getAnnotationsJar()),
|
||||||
Collections.singletonList(javaFilesDir)
|
Collections.singletonList(javaFilesDir)
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ public class ForTestCompileRuntime {
|
|||||||
return assertExists(new File("dist/kotlinc/lib/kotlin-runtime.jar"));
|
return assertExists(new File("dist/kotlinc/lib/kotlin-runtime.jar"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static File mockRuntimeJarForTests() {
|
||||||
|
return assertExists(new File("dist/kotlin-mock-runtime-for-test.jar"));
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static File kotlinTestJarForTests() {
|
public static File kotlinTestJarForTests() {
|
||||||
return assertExists(new File("dist/kotlinc/lib/kotlin-test.jar"));
|
return assertExists(new File("dist/kotlinc/lib/kotlin-test.jar"));
|
||||||
|
|||||||
@@ -17,10 +17,12 @@
|
|||||||
package org.jetbrains.kotlin.test
|
package org.jetbrains.kotlin.test
|
||||||
|
|
||||||
enum class ConfigurationKind(
|
enum class ConfigurationKind(
|
||||||
val withRuntime: Boolean,
|
val withRuntime: Boolean = false,
|
||||||
val withReflection: Boolean
|
val withMockRuntime: Boolean = false,
|
||||||
|
val withReflection: Boolean = false
|
||||||
) {
|
) {
|
||||||
JDK_ONLY(withRuntime = false, withReflection = false),
|
JDK_ONLY(),
|
||||||
NO_KOTLIN_REFLECT(withRuntime = true, withReflection = false),
|
MOCK_RUNTIME(withMockRuntime = true),
|
||||||
|
NO_KOTLIN_REFLECT(withRuntime = true),
|
||||||
ALL(withRuntime = true, withReflection = true),
|
ALL(withRuntime = true, withReflection = true),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -448,6 +448,9 @@ public class KotlinTestUtils {
|
|||||||
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.runtimeJarForTests());
|
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.runtimeJarForTests());
|
||||||
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.kotlinTestJarForTests());
|
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.kotlinTestJarForTests());
|
||||||
}
|
}
|
||||||
|
else if (configurationKind.getWithMockRuntime()) {
|
||||||
|
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.mockRuntimeJarForTests());
|
||||||
|
}
|
||||||
if (configurationKind.getWithReflection()) {
|
if (configurationKind.getWithReflection()) {
|
||||||
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.reflectJarForTests());
|
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.reflectJarForTests());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user