Rename compilerConfigurationForTests -> newConfiguration
This commit is contained in:
@@ -83,7 +83,7 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
|
||||
@NotNull TestJdkKind jdkKind,
|
||||
@NotNull List<String> javacOptions
|
||||
) {
|
||||
CompilerConfiguration configuration = createCompilerConfigurationForTests(
|
||||
CompilerConfiguration configuration = createConfiguration(
|
||||
configurationKind, jdkKind,
|
||||
Collections.singletonList(getAnnotationsJar()),
|
||||
ArraysKt.filterNotNull(new File[] {javaSourceDir}),
|
||||
|
||||
+5
-3
@@ -108,12 +108,14 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTest
|
||||
|
||||
@NotNull
|
||||
private ClassFileFactory compileB(@NotNull String fileName, @NotNull String content, List<TestFile> files) throws IOException {
|
||||
CompilerConfiguration configurationWithADirInClasspath = KotlinTestUtils
|
||||
.compilerConfigurationForTests(ConfigurationKind.ALL, getJdkKind(files), KotlinTestUtils.getAnnotationsJar(), aDir);
|
||||
CompilerConfiguration configurationWithADirInClasspath = KotlinTestUtils.newConfiguration(
|
||||
ConfigurationKind.ALL, getJdkKind(files), KotlinTestUtils.getAnnotationsJar(), aDir
|
||||
);
|
||||
|
||||
Disposable compileDisposable = createDisposable("compileB");
|
||||
KotlinCoreEnvironment environment = KotlinCoreEnvironment.createForTests(
|
||||
compileDisposable, configurationWithADirInClasspath, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
compileDisposable, configurationWithADirInClasspath, EnvironmentConfigFiles.JVM_CONFIG_FILES
|
||||
);
|
||||
|
||||
return compileKotlin(fileName, content, bDir, environment, compileDisposable);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ abstract class AbstractDumpDeclarationsTest : CodegenTestCase() {
|
||||
val dumpToFile = KotlinTestUtils.tmpDirForTest(this).resolve(this.name + ".json")
|
||||
|
||||
val configuration =
|
||||
KotlinTestUtils.compilerConfigurationForTests(configurationKind, TestJdkKind.MOCK_JDK, KotlinTestUtils.getAnnotationsJar())
|
||||
KotlinTestUtils.newConfiguration(configurationKind, TestJdkKind.MOCK_JDK, KotlinTestUtils.getAnnotationsJar())
|
||||
configuration.put(JVMConfigurationKeys.DECLARATIONS_JSON_PATH, dumpToFile.path)
|
||||
|
||||
myEnvironment = KotlinCoreEnvironment.createForTests(testRootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
|
||||
|
||||
@@ -51,9 +51,11 @@ public abstract class AbstractLineNumberTest extends TestCaseWithTmpdir {
|
||||
private KotlinCoreEnvironment createEnvironment() {
|
||||
return KotlinCoreEnvironment.createForTests(
|
||||
myTestRootDisposable,
|
||||
KotlinTestUtils.compilerConfigurationForTests(ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK,
|
||||
KotlinTestUtils.getAnnotationsJar(), tmpdir),
|
||||
EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
KotlinTestUtils.newConfiguration(
|
||||
ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, KotlinTestUtils.getAnnotationsJar(), tmpdir
|
||||
),
|
||||
EnvironmentConfigFiles.JVM_CONFIG_FILES
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-2
@@ -68,8 +68,10 @@ public abstract class AbstractTopLevelMembersInvocationTest extends AbstractByte
|
||||
|
||||
myEnvironment = KotlinCoreEnvironment.createForTests(
|
||||
getTestRootDisposable(),
|
||||
KotlinTestUtils.compilerConfigurationForTests(ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK,
|
||||
CollectionsKt.plus(classPath, KotlinTestUtils.getAnnotationsJar()), classPath),
|
||||
KotlinTestUtils.newConfiguration(
|
||||
ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK,
|
||||
CollectionsKt.plus(classPath, KotlinTestUtils.getAnnotationsJar()), classPath
|
||||
),
|
||||
EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
|
||||
loadFiles(ArrayUtil.toStringArray(sourceFiles));
|
||||
|
||||
@@ -72,7 +72,6 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.jetbrains.kotlin.codegen.CodegenTestUtil.*;
|
||||
import static org.jetbrains.kotlin.test.KotlinTestUtils.compilerConfigurationForTests;
|
||||
import static org.jetbrains.kotlin.test.KotlinTestUtils.getAnnotationsJar;
|
||||
|
||||
public abstract class CodegenTestCase extends KtUsefulTestCase {
|
||||
@@ -110,7 +109,7 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
|
||||
throw new IllegalStateException("must not set up myEnvironment twice");
|
||||
}
|
||||
|
||||
CompilerConfiguration configuration = createCompilerConfigurationForTests(
|
||||
CompilerConfiguration configuration = createConfiguration(
|
||||
configurationKind,
|
||||
TestJdkKind.MOCK_JDK,
|
||||
Collections.singletonList(getAnnotationsJar()),
|
||||
@@ -124,14 +123,14 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected static CompilerConfiguration createCompilerConfigurationForTests(
|
||||
protected static CompilerConfiguration createConfiguration(
|
||||
@NotNull ConfigurationKind kind,
|
||||
@NotNull TestJdkKind jdkKind,
|
||||
@NotNull List<File> classpath,
|
||||
@NotNull List<File> javaSource,
|
||||
@NotNull List<TestFile> testFilesWithConfigurationDirectives
|
||||
) {
|
||||
CompilerConfiguration configuration = compilerConfigurationForTests(kind, jdkKind, classpath, javaSource);
|
||||
CompilerConfiguration configuration = KotlinTestUtils.newConfiguration(kind, jdkKind, classpath, javaSource);
|
||||
|
||||
updateConfigurationByDirectivesInTestFiles(testFilesWithConfigurationDirectives, configuration);
|
||||
|
||||
@@ -495,7 +494,7 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
|
||||
protected void doTest(String filePath) throws Exception {
|
||||
File file = new File(filePath);
|
||||
String expectedText = KotlinTestUtils.doLoadFile(file);
|
||||
final Ref<File> javaFilesDir = Ref.create();
|
||||
Ref<File> javaFilesDir = Ref.create();
|
||||
|
||||
List<TestFile> testFiles = createTestFiles(file, expectedText, javaFilesDir);
|
||||
|
||||
@@ -503,7 +502,7 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<TestFile> createTestFiles(File file, String expectedText, final Ref<File> javaFilesDir) {
|
||||
private static List<TestFile> createTestFiles(File file, String expectedText, final Ref<File> javaFilesDir) {
|
||||
return KotlinTestUtils.createTestFiles(file.getName(), expectedText, new KotlinTestUtils.TestFileFactoryNoModules<TestFile>() {
|
||||
@NotNull
|
||||
@Override
|
||||
|
||||
@@ -111,7 +111,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
File ktFile = new File(ktFileName);
|
||||
File txtFile = new File(ktFileName.replaceFirst("\\.kt$", ".txt"));
|
||||
|
||||
CompilerConfiguration configuration = compilerConfigurationForTests(configurationKind, TestJdkKind.MOCK_JDK, getAnnotationsJar());
|
||||
CompilerConfiguration configuration = newConfiguration(configurationKind, TestJdkKind.MOCK_JDK, getAnnotationsJar());
|
||||
if (useTypeTableInSerializer) {
|
||||
configuration.put(JVMConfigurationKeys.USE_TYPE_TABLE, true);
|
||||
}
|
||||
@@ -151,7 +151,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
}
|
||||
});
|
||||
|
||||
CompilerConfiguration configuration = KotlinTestUtils.compilerConfigurationForTests(ConfigurationKind.JDK_ONLY, getJdkKind());
|
||||
CompilerConfiguration configuration = KotlinTestUtils.newConfiguration(ConfigurationKind.JDK_ONLY, getJdkKind());
|
||||
ContentRootsKt.addKotlinSourceRoot(configuration, sourcesDir.getAbsolutePath());
|
||||
JvmContentRootsKt.addJavaSourceRoot(configuration, new File("compiler/testData/loadJava/include"));
|
||||
JvmContentRootsKt.addJavaSourceRoot(configuration, tmpdir);
|
||||
@@ -187,8 +187,9 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
|
||||
KotlinCoreEnvironment environment = KotlinCoreEnvironment.createForTests(
|
||||
getTestRootDisposable(),
|
||||
compilerConfigurationForTests(ConfigurationKind.JDK_ONLY, getJdkKind(), getAnnotationsJar(), libraryOut),
|
||||
EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
newConfiguration(ConfigurationKind.JDK_ONLY, getJdkKind(), getAnnotationsJar(), libraryOut),
|
||||
EnvironmentConfigFiles.JVM_CONFIG_FILES
|
||||
);
|
||||
|
||||
KtFile ktFile = KotlinTestUtils.createFile(kotlinSrc.getPath(), FileUtil.loadFile(kotlinSrc, true), environment.getProject());
|
||||
|
||||
|
||||
@@ -84,12 +84,8 @@ public class LoadDescriptorUtil {
|
||||
else {
|
||||
javaSourceRoots.add(javaRoot);
|
||||
}
|
||||
CompilerConfiguration configuration = KotlinTestUtils.compilerConfigurationForTests(
|
||||
configurationKind,
|
||||
testJdkKind,
|
||||
javaBinaryRoots,
|
||||
javaSourceRoots
|
||||
);
|
||||
CompilerConfiguration configuration =
|
||||
KotlinTestUtils.newConfiguration(configurationKind, testJdkKind, javaBinaryRoots, javaSourceRoots);
|
||||
KotlinCoreEnvironment environment =
|
||||
KotlinCoreEnvironment.createForTests(disposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
|
||||
|
||||
@@ -305,9 +305,8 @@ public class KotlinTestUtils {
|
||||
@NotNull TestJdkKind jdkKind
|
||||
) {
|
||||
return KotlinCoreEnvironment.createForTests(
|
||||
disposable,
|
||||
compilerConfigurationForTests(configurationKind, jdkKind, getAnnotationsJar()),
|
||||
EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
disposable, newConfiguration(configurationKind, jdkKind, getAnnotationsJar()), EnvironmentConfigFiles.JVM_CONFIG_FILES
|
||||
);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -426,16 +425,16 @@ public class KotlinTestUtils {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static CompilerConfiguration compilerConfigurationForTests(
|
||||
public static CompilerConfiguration newConfiguration(
|
||||
@NotNull ConfigurationKind configurationKind,
|
||||
@NotNull TestJdkKind jdkKind,
|
||||
@NotNull File... extraClasspath
|
||||
) {
|
||||
return compilerConfigurationForTests(configurationKind, jdkKind, Arrays.asList(extraClasspath), Collections.<File>emptyList());
|
||||
return newConfiguration(configurationKind, jdkKind, Arrays.asList(extraClasspath), Collections.<File>emptyList());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static CompilerConfiguration compilerConfigurationForTests(
|
||||
public static CompilerConfiguration newConfiguration(
|
||||
@NotNull ConfigurationKind configurationKind,
|
||||
@NotNull TestJdkKind jdkKind,
|
||||
@NotNull List<File> classpath,
|
||||
|
||||
Reference in New Issue
Block a user