Introducing KotlinPaths to impose some discipline on compiler/library location
This commit is contained in:
@@ -49,6 +49,7 @@ import org.jetbrains.jet.test.TestMetadata;
|
||||
import org.jetbrains.jet.util.slicedmap.ReadOnlySlice;
|
||||
import org.jetbrains.jet.util.slicedmap.SlicedMap;
|
||||
import org.jetbrains.jet.util.slicedmap.WritableSlice;
|
||||
import org.jetbrains.jet.utils.KotlinPaths;
|
||||
import org.junit.Assert;
|
||||
|
||||
import javax.tools.*;
|
||||
@@ -469,4 +470,8 @@ public class JetTestUtils {
|
||||
private static String getSimpleName(String generatorClassFqName) {
|
||||
return generatorClassFqName.substring(generatorClassFqName.lastIndexOf(".") + 1);
|
||||
}
|
||||
|
||||
public static KotlinPaths getPathsForTests() {
|
||||
return new KotlinPaths(new File("dist/kotlinc"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.jet.cli.jvm;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import junit.framework.Assert;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.cli.common.CLICompiler;
|
||||
import org.jetbrains.jet.cli.common.ExitCode;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.KotlinToJVMBytecodeCompiler;
|
||||
@@ -170,7 +171,7 @@ public class CliTest {
|
||||
AnalyzerScriptParameter parameter = new AnalyzerScriptParameter(Name.identifier("num"), JetTypeName.parse("jet.Int"));
|
||||
scriptParameters.add(parameter);
|
||||
Class aClass = KotlinToJVMBytecodeCompiler
|
||||
.compileScript(getClass().getClassLoader(), "compiler/testData/cli/fib.ktscript", scriptParameters, null);
|
||||
.compileScript(getClass().getClassLoader(), JetTestUtils.getPathsForTests(), "compiler/testData/cli/fib.ktscript", scriptParameters, null);
|
||||
Assert.assertNotNull(aClass);
|
||||
|
||||
try {
|
||||
@@ -187,7 +188,7 @@ public class CliTest {
|
||||
AnalyzerScriptParameter parameter = new AnalyzerScriptParameter(Name.identifier("num"), JetTypeName.parse("jet.Int"));
|
||||
scriptParameters.add(parameter);
|
||||
Class aClass = KotlinToJVMBytecodeCompiler
|
||||
.compileScript(getClass().getClassLoader(), "compiler/testData/cli/fib.kt", scriptParameters, null);
|
||||
.compileScript(getClass().getClassLoader(), JetTestUtils.getPathsForTests(), "compiler/testData/cli/fib.kt", scriptParameters, null);
|
||||
Assert.assertNotNull(aClass);
|
||||
|
||||
try {
|
||||
@@ -205,7 +206,7 @@ public class CliTest {
|
||||
AnalyzerScriptParameter parameter = new AnalyzerScriptParameter(Name.identifier("num"), JetTypeName.parse("jet.Int"));
|
||||
scriptParameters.add(parameter);
|
||||
Class aClass = KotlinToJVMBytecodeCompiler
|
||||
.compileScript(getClass().getClassLoader(), "compiler/testData/cli/fib.fib.kt", null, Arrays.asList(new JetScriptDefinition(".fib.kt",scriptParameters)));
|
||||
.compileScript(getClass().getClassLoader(), JetTestUtils.getPathsForTests(), "compiler/testData/cli/fib.fib.kt", null, Arrays.asList(new JetScriptDefinition(".fib.kt",scriptParameters)));
|
||||
Assert.assertNotNull(aClass);
|
||||
|
||||
try {
|
||||
|
||||
+4
-5
@@ -37,7 +37,6 @@ import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
import org.jetbrains.jet.resolve.DescriptorRenderer;
|
||||
import org.jetbrains.jet.test.TestCaseWithTmpdir;
|
||||
import org.jetbrains.jet.utils.PathUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -64,14 +63,14 @@ public class AnnotationJavaDescriptorResolverTest extends TestCaseWithTmpdir {
|
||||
|
||||
StringBuilder builder = new StringBuilder(tmpdir.getAbsolutePath());
|
||||
builder.append(File.pathSeparator);
|
||||
File runtimePath = PathUtil.getDefaultRuntimePath();
|
||||
if (runtimePath != null) {
|
||||
File runtimePath = JetTestUtils.getPathsForTests().getRuntimePath();
|
||||
if (runtimePath.exists()) {
|
||||
builder.append(runtimePath.getAbsolutePath());
|
||||
builder.append(File.pathSeparator);
|
||||
}
|
||||
|
||||
File annotationsPath = PathUtil.getJdkAnnotationsPath();
|
||||
if (annotationsPath != null) {
|
||||
File annotationsPath = JetTestUtils.getPathsForTests().getJdkAnnotationsPath();
|
||||
if (annotationsPath.exists()) {
|
||||
builder.append(annotationsPath.getAbsolutePath());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user