CompileEnvironment removed
What used to be CompileEnvironment, now is split into data (in CompileEnvironmentConfiguration) and utility methods (in CompileEnvironmentUtil). CompilerDependencies should be removed later. All the relevant stuff sits in the JetCoreEnvironment class
This commit is contained in:
@@ -17,8 +17,12 @@
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
import org.jetbrains.jet.CompileCompilerDependenciesTest;
|
||||
import org.jetbrains.jet.compiler.CompileEnvironment;
|
||||
import org.jetbrains.jet.compiler.CompileEnvironmentConfiguration;
|
||||
import org.jetbrains.jet.compiler.CompileEnvironmentUtil;
|
||||
import org.jetbrains.jet.compiler.JetCoreEnvironment;
|
||||
import org.jetbrains.jet.compiler.KotlinToJVMBytecodeCompiler;
|
||||
import org.jetbrains.jet.compiler.messages.MessageCollector;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerDependencies;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@@ -27,9 +31,11 @@ import java.lang.reflect.Method;
|
||||
public class CompileTextTest extends CodegenTestCase {
|
||||
public void testMe() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
||||
String text = "import org.jetbrains.jet.codegen.CompileTextTest; fun x() = CompileTextTest()";
|
||||
CompileEnvironment compileEnvironment = new CompileEnvironment(MessageCollector.PLAIN_TEXT_TO_SYSTEM_ERR, CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR));
|
||||
compileEnvironment.getEnvironment().addToClasspathFromClassLoader(getClass().getClassLoader());
|
||||
ClassLoader classLoader = compileEnvironment.compileText(text);
|
||||
CompilerDependencies dependencies = CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR);
|
||||
JetCoreEnvironment environment = new JetCoreEnvironment(CompileEnvironmentUtil.createMockDisposable(), dependencies);
|
||||
CompileEnvironmentConfiguration configuration = new CompileEnvironmentConfiguration(environment, dependencies, MessageCollector.PLAIN_TEXT_TO_SYSTEM_ERR);
|
||||
configuration.getEnvironment().addToClasspathFromClassLoader(getClass().getClassLoader());
|
||||
ClassLoader classLoader = KotlinToJVMBytecodeCompiler.compileText(configuration, text);
|
||||
Class<?> namespace = classLoader.loadClass("namespace");
|
||||
Method x = namespace.getDeclaredMethod("x");
|
||||
Object invoke = x.invoke(null);
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileRuntime;
|
||||
import org.jetbrains.jet.compiler.CompileEnvironment;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.annotation.*;
|
||||
@@ -28,8 +28,6 @@ import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user