Fix various tests and test data
Since we now distinguish between binaries and java source roots
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
$TESTDATA_DIR$/wrongKotlinSignature.kt
|
$TESTDATA_DIR$/wrongKotlinSignature.kt
|
||||||
-cp
|
|
||||||
$TESTDATA_DIR$/wrongKotlinSignatureLib
|
$TESTDATA_DIR$/wrongKotlinSignatureLib
|
||||||
-d
|
-d
|
||||||
$TEMP_DIR$
|
$TEMP_DIR$
|
||||||
|
|||||||
+2
-1
@@ -42,6 +42,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.jetbrains.kotlin.cli.jvm.config.ConfigPackage.addJavaSourceRoot;
|
||||||
import static org.jetbrains.kotlin.cli.jvm.config.ConfigPackage.addJvmClasspathRoot;
|
import static org.jetbrains.kotlin.cli.jvm.config.ConfigPackage.addJvmClasspathRoot;
|
||||||
import static org.jetbrains.kotlin.codegen.CodegenTestUtil.compileJava;
|
import static org.jetbrains.kotlin.codegen.CodegenTestUtil.compileJava;
|
||||||
import static org.jetbrains.kotlin.load.kotlin.PackageClassUtils.getPackageClassFqName;
|
import static org.jetbrains.kotlin.load.kotlin.PackageClassUtils.getPackageClassFqName;
|
||||||
@@ -144,7 +145,7 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
|
|||||||
CompilerConfiguration configuration = JetTestUtils.compilerConfigurationForTests(
|
CompilerConfiguration configuration = JetTestUtils.compilerConfigurationForTests(
|
||||||
ConfigurationKind.ALL, TestJdkKind.MOCK_JDK, JetTestUtils.getAnnotationsJar()
|
ConfigurationKind.ALL, TestJdkKind.MOCK_JDK, JetTestUtils.getAnnotationsJar()
|
||||||
);
|
);
|
||||||
addJvmClasspathRoot(configuration, dirFile);
|
addJavaSourceRoot(configuration, dirFile);
|
||||||
myEnvironment = KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
myEnvironment = KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||||
loadFiles(ArrayUtil.toStringArray(ktFilePaths));
|
loadFiles(ArrayUtil.toStringArray(ktFilePaths));
|
||||||
classFileFactory =
|
classFileFactory =
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
|||||||
Assert.assertEquals("test", packageFromSource.getName().asString());
|
Assert.assertEquals("test", packageFromSource.getName().asString());
|
||||||
|
|
||||||
PackageViewDescriptor packageFromBinary = LoadDescriptorUtil.loadTestPackageAndBindingContextFromJavaRoot(
|
PackageViewDescriptor packageFromBinary = LoadDescriptorUtil.loadTestPackageAndBindingContextFromJavaRoot(
|
||||||
tmpdir, getTestRootDisposable(), TestJdkKind.MOCK_JDK, configurationKind
|
tmpdir, getTestRootDisposable(), TestJdkKind.MOCK_JDK, configurationKind, true
|
||||||
).first;
|
).first;
|
||||||
|
|
||||||
for (DeclarationDescriptor descriptor : packageFromBinary.getMemberScope().getAllDescriptors()) {
|
for (DeclarationDescriptor descriptor : packageFromBinary.getMemberScope().getAllDescriptors()) {
|
||||||
@@ -140,10 +140,11 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
|||||||
});
|
});
|
||||||
|
|
||||||
CompilerConfiguration configuration = JetTestUtils.compilerConfigurationForTests(
|
CompilerConfiguration configuration = JetTestUtils.compilerConfigurationForTests(
|
||||||
ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, tmpdir);
|
ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK);
|
||||||
addKotlinSourceRoot(configuration, sourcesDir.getAbsolutePath());
|
addKotlinSourceRoot(configuration, sourcesDir.getAbsolutePath());
|
||||||
addJavaSourceRoot(configuration, new File("compiler/testData/loadJava/include"));
|
addJavaSourceRoot(configuration, new File("compiler/testData/loadJava/include"));
|
||||||
|
addJavaSourceRoot(configuration, tmpdir);
|
||||||
|
|
||||||
KotlinCoreEnvironment environment =
|
KotlinCoreEnvironment environment =
|
||||||
KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||||
|
|
||||||
@@ -211,7 +212,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
|||||||
FileUtil.copy(originalJavaFile, new File(testPackageDir, originalJavaFile.getName()));
|
FileUtil.copy(originalJavaFile, new File(testPackageDir, originalJavaFile.getName()));
|
||||||
|
|
||||||
Pair<PackageViewDescriptor, BindingContext> javaPackageAndContext = loadTestPackageAndBindingContextFromJavaRoot(
|
Pair<PackageViewDescriptor, BindingContext> javaPackageAndContext = loadTestPackageAndBindingContextFromJavaRoot(
|
||||||
tmpdir, getTestRootDisposable(), TestJdkKind.MOCK_JDK, ConfigurationKind.JDK_ONLY
|
tmpdir, getTestRootDisposable(), TestJdkKind.MOCK_JDK, ConfigurationKind.JDK_ONLY, false
|
||||||
);
|
);
|
||||||
|
|
||||||
checkJavaPackage(expectedFile, javaPackageAndContext.first, javaPackageAndContext.second,
|
checkJavaPackage(expectedFile, javaPackageAndContext.first, javaPackageAndContext.second,
|
||||||
@@ -258,7 +259,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
|||||||
@NotNull ConfigurationKind configurationKind
|
@NotNull ConfigurationKind configurationKind
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
compileJavaWithAnnotationsJar(javaFiles, outDir);
|
compileJavaWithAnnotationsJar(javaFiles, outDir);
|
||||||
return loadTestPackageAndBindingContextFromJavaRoot(outDir, myTestRootDisposable, TestJdkKind.MOCK_JDK, configurationKind);
|
return loadTestPackageAndBindingContextFromJavaRoot(outDir, myTestRootDisposable, TestJdkKind.MOCK_JDK, configurationKind, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkJavaPackage(
|
private static void checkJavaPackage(
|
||||||
|
|||||||
@@ -46,10 +46,7 @@ import org.jetbrains.kotlin.test.TestJdkKind;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static org.jetbrains.kotlin.test.JetTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations;
|
import static org.jetbrains.kotlin.test.JetTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations;
|
||||||
|
|
||||||
@@ -81,14 +78,25 @@ public final class LoadDescriptorUtil {
|
|||||||
@NotNull File javaRoot,
|
@NotNull File javaRoot,
|
||||||
@NotNull Disposable disposable,
|
@NotNull Disposable disposable,
|
||||||
@NotNull TestJdkKind testJdkKind,
|
@NotNull TestJdkKind testJdkKind,
|
||||||
@NotNull ConfigurationKind configurationKind
|
@NotNull ConfigurationKind configurationKind,
|
||||||
|
boolean isBinaryRoot
|
||||||
) {
|
) {
|
||||||
|
List<File> javaBinaryRoots = new ArrayList<File>();
|
||||||
|
javaBinaryRoots.add(JetTestUtils.getAnnotationsJar());
|
||||||
|
|
||||||
|
List<File> javaSourceRoots = new ArrayList<File>();
|
||||||
|
javaSourceRoots.add(new File("compiler/testData/loadJava/include"));
|
||||||
|
if (isBinaryRoot) {
|
||||||
|
javaBinaryRoots.add(javaRoot);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
javaSourceRoots.add(javaRoot);
|
||||||
|
}
|
||||||
CompilerConfiguration configuration = JetTestUtils.compilerConfigurationForTests(
|
CompilerConfiguration configuration = JetTestUtils.compilerConfigurationForTests(
|
||||||
configurationKind,
|
configurationKind,
|
||||||
testJdkKind,
|
testJdkKind,
|
||||||
JetTestUtils.getAnnotationsJar(),
|
javaBinaryRoots,
|
||||||
javaRoot,
|
javaSourceRoots
|
||||||
new File("compiler/testData/loadJava/include")
|
|
||||||
);
|
);
|
||||||
KotlinCoreEnvironment environment =
|
KotlinCoreEnvironment environment =
|
||||||
KotlinCoreEnvironment.createForTests(disposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
KotlinCoreEnvironment.createForTests(disposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||||
|
|||||||
+1
-1
@@ -90,7 +90,7 @@ public abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdi
|
|||||||
val actual = createReflectedPackageView(classLoader)
|
val actual = createReflectedPackageView(classLoader)
|
||||||
|
|
||||||
val expected = LoadDescriptorUtil.loadTestPackageAndBindingContextFromJavaRoot(
|
val expected = LoadDescriptorUtil.loadTestPackageAndBindingContextFromJavaRoot(
|
||||||
tmpdir, getTestRootDisposable(), jdkKind, ConfigurationKind.ALL
|
tmpdir, getTestRootDisposable(), jdkKind, ConfigurationKind.ALL, true
|
||||||
).first
|
).first
|
||||||
|
|
||||||
val comparatorConfiguration = Configuration(
|
val comparatorConfiguration = Configuration(
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<sources path="s1"/>
|
<sources path="s1"/>
|
||||||
<sources path="s2"/>
|
<sources path="s2"/>
|
||||||
<!-- Java source roots -->
|
<!-- Java source roots -->
|
||||||
<classpath path="java"/>
|
<javaSourceRoots path="java"/>
|
||||||
<!-- Classpath -->
|
<!-- Classpath -->
|
||||||
<classpath path="cp1"/>
|
<classpath path="cp1"/>
|
||||||
<classpath path="cp2"/>
|
<classpath path="cp2"/>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<module name="name" outputDir="output">
|
<module name="name" outputDir="output">
|
||||||
<sources path="s1"/>
|
<sources path="s1"/>
|
||||||
<sources path="s2"/>
|
<sources path="s2"/>
|
||||||
|
<!-- Java source roots -->
|
||||||
<!-- Classpath -->
|
<!-- Classpath -->
|
||||||
<!-- Output directory, commented out -->
|
<!-- Output directory, commented out -->
|
||||||
<!--
|
<!--
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<module name="name" outputDir="output">
|
<module name="name" outputDir="output">
|
||||||
<sources path="s1"/>
|
<sources path="s1"/>
|
||||||
<sources path="s2"/>
|
<sources path="s2"/>
|
||||||
|
<!-- Java source roots -->
|
||||||
<!-- Classpath -->
|
<!-- Classpath -->
|
||||||
<!-- Output directory, commented out -->
|
<!-- Output directory, commented out -->
|
||||||
<!--
|
<!--
|
||||||
@@ -17,6 +18,7 @@
|
|||||||
<module name="name2" outputDir="output2">
|
<module name="name2" outputDir="output2">
|
||||||
<sources path="s12"/>
|
<sources path="s12"/>
|
||||||
<sources path="s22"/>
|
<sources path="s22"/>
|
||||||
|
<!-- Java source roots -->
|
||||||
<!-- Classpath -->
|
<!-- Classpath -->
|
||||||
<!-- Output directory, commented out -->
|
<!-- Output directory, commented out -->
|
||||||
<!--
|
<!--
|
||||||
|
|||||||
Reference in New Issue
Block a user