Introduce black box with Java codegen tests

In contrast to "black box against Java", it supports cyclic dependencies
between Java and Kotlin sources in one test case
This commit is contained in:
Alexander Udalov
2014-06-25 03:59:37 +04:00
parent 09863445bb
commit aea230d677
6 changed files with 109 additions and 10 deletions
@@ -19,6 +19,7 @@ package org.jetbrains.jet.codegen;
import com.google.common.base.Predicates;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.psi.PsiFile;
import kotlin.KotlinPackage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.JetTestUtils;
@@ -39,6 +40,7 @@ import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -108,13 +110,15 @@ public class CodegenTestUtil {
}
@NotNull
public static File compileJava(@NotNull String filename) {
public static File compileJava(@NotNull String filename, @NotNull String... additionalClasspath) {
try {
File javaClassesTempDirectory = JetTestUtils.tmpDir("java-classes");
String classPath = ForTestCompileRuntime.runtimeJarForTests() + File.pathSeparator +
JetTestUtils.getAnnotationsJar().getPath();
List<String> classpath = new ArrayList<String>();
classpath.add(ForTestCompileRuntime.runtimeJarForTests().getPath());
classpath.add(JetTestUtils.getAnnotationsJar().getPath());
classpath.addAll(Arrays.asList(additionalClasspath));
List<String> options = Arrays.asList(
"-classpath", classPath,
"-classpath", KotlinPackage.join(classpath, File.pathSeparator, "", "", -1, ""),
"-d", javaClassesTempDirectory.getPath()
);