proper environment when compiling special things
* do not include anything when compiling builtins * do not include kotlin-runtime and jdk-headers when compiling jdk-headers
This commit is contained in:
@@ -27,7 +27,7 @@ public class CompileBuiltinsTest extends TestCaseWithTmpdirIndependentFromIdea {
|
||||
@Test
|
||||
public void compile() {
|
||||
KotlinCompiler.ExitCode exitCode = new KotlinCompiler().exec(
|
||||
System.err, "-output", tmpdir.getPath(), "-src", "./compiler/frontend/src", "-stubs");
|
||||
System.err, "-output", tmpdir.getPath(), "-src", "./compiler/frontend/src", "-mode", "builtins");
|
||||
if (exitCode != KotlinCompiler.ExitCode.OK) {
|
||||
throw new IllegalStateException("jdk headers compilation failed: " + exitCode);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class CompileJdkHeadersTest extends TestCaseWithTmpdirIndependentFromIdea
|
||||
@Test
|
||||
public void compile() {
|
||||
KotlinCompiler.ExitCode exitCode = new KotlinCompiler().exec(
|
||||
System.err, "-output", tmpdir.getPath(), "-src", "./jdk-headers/src", "-stubs");
|
||||
System.err, "-output", tmpdir.getPath(), "-src", "./jdk-headers/src", "-mode", "jdkHeaders");
|
||||
if (exitCode != KotlinCompiler.ExitCode.OK) {
|
||||
throw new IllegalStateException("jdk headers compilation failed: " + exitCode);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public abstract class JetLiteFixture extends UsefulTestCase {
|
||||
}
|
||||
|
||||
protected void createEnvironmentWithFullJdk() {
|
||||
myEnvironment = new JetCoreEnvironment(getTestRootDisposable());
|
||||
myEnvironment = new JetCoreEnvironment(getTestRootDisposable(), true);
|
||||
final File rtJar = CompileEnvironment.findRtJar();
|
||||
myEnvironment.addToClasspath(rtJar);
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ public class JetTestUtils {
|
||||
|
||||
|
||||
public static JetCoreEnvironment createEnvironmentWithMockJdk(Disposable disposable) {
|
||||
JetCoreEnvironment environment = new JetCoreEnvironment(disposable);
|
||||
JetCoreEnvironment environment = new JetCoreEnvironment(disposable, true);
|
||||
final File rtJar = new File(JetTestCaseBuilder.getHomeDirectory(), "compiler/testData/mockJDK-1.7/jre/lib/rt.jar");
|
||||
environment.addToClasspath(rtJar);
|
||||
environment.addToClasspath(getAnnotationsJar());
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
@@ -166,7 +167,7 @@ public class JetDiagnosticsTest extends JetLiteFixture {
|
||||
}
|
||||
|
||||
BindingContext bindingContext = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(
|
||||
getProject(), jetFiles, Predicates.<PsiFile>alwaysTrue(), JetControlFlowDataTraceFactory.EMPTY)
|
||||
getProject(), jetFiles, Predicates.<PsiFile>alwaysTrue(), JetControlFlowDataTraceFactory.EMPTY, CompilerSpecialMode.REGULAR)
|
||||
.getBindingContext();
|
||||
|
||||
boolean ok = true;
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.jetbrains.jet.lang.psi.JetClass;
|
||||
import org.jetbrains.jet.lang.psi.JetDeclaration;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.parsing.JetParsingTest;
|
||||
|
||||
@@ -69,7 +70,7 @@ public class TestlibTest extends CodegenTestCase {
|
||||
|
||||
private TestSuite doBuildSuite() {
|
||||
try {
|
||||
CompileSession session = new CompileSession(myEnvironment, MessageRenderer.PLAIN, System.err, false);
|
||||
CompileSession session = new CompileSession(myEnvironment, MessageRenderer.PLAIN, System.err, false, CompilerSpecialMode.REGULAR);
|
||||
|
||||
myEnvironment.addToClasspath(ForTestCompileStdlib.stdlibJarForTests());
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzeExhaust;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.lang.types.ErrorUtils;
|
||||
import org.jetbrains.jet.lang.types.lang.JetStandardLibrary;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
@@ -137,7 +138,8 @@ public abstract class ExpectedResolveData {
|
||||
Project project = files.iterator().next().getProject();
|
||||
JetStandardLibrary lib = JetStandardLibrary.getInstance();
|
||||
|
||||
AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(project, files, Predicates.<PsiFile>alwaysTrue(), JetControlFlowDataTraceFactory.EMPTY);
|
||||
AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(project, files,
|
||||
Predicates.<PsiFile>alwaysTrue(), JetControlFlowDataTraceFactory.EMPTY, CompilerSpecialMode.REGULAR);
|
||||
BindingContext bindingContext = analyzeExhaust.getBindingContext();
|
||||
for (Diagnostic diagnostic : bindingContext.getDiagnostics()) {
|
||||
if (diagnostic instanceof UnresolvedReferenceDiagnostic) {
|
||||
|
||||
Reference in New Issue
Block a user