Moved CompilerSpecialMode.includeXXX() methods into configuration generators to make it clear that they are used only during initialization.
This commit is contained in:
@@ -25,6 +25,8 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode.*;
|
||||
|
||||
/**
|
||||
* @author Evgeny Gerashchenko
|
||||
* @since 7/4/12
|
||||
@@ -33,14 +35,14 @@ public class CompilerConfigurationUtl {
|
||||
// TODO merge with similar K2JVMCompiler method
|
||||
public static CompilerConfiguration getDefaultConfiguration(@NotNull CompilerSpecialMode compilerSpecialMode) {
|
||||
List<File> classpath = new ArrayList<File>();
|
||||
if (compilerSpecialMode.includeJdk()) {
|
||||
if (includeJdk(compilerSpecialMode)) {
|
||||
classpath.add(PathUtil.findRtJar());
|
||||
}
|
||||
if (compilerSpecialMode.includeKotlinRuntime()) {
|
||||
if (includeKotlinRuntime(compilerSpecialMode)) {
|
||||
classpath.add(PathUtil.getDefaultRuntimePath());
|
||||
}
|
||||
File[] annotationsPath = new File[0];
|
||||
if (compilerSpecialMode.includeJdkAnnotations()) {
|
||||
if (includeJdkAnnotations(compilerSpecialMode)) {
|
||||
annotationsPath = new File[]{PathUtil.getJdkAnnotationsPath()};
|
||||
}
|
||||
|
||||
@@ -49,4 +51,16 @@ public class CompilerConfigurationUtl {
|
||||
configuration.putUserData(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, annotationsPath);
|
||||
return configuration;
|
||||
}
|
||||
|
||||
private static boolean includeJdkAnnotations(@NotNull CompilerSpecialMode mode) {
|
||||
return mode == REGULAR || mode == STDLIB || mode == IDEA;
|
||||
}
|
||||
|
||||
public static boolean includeKotlinRuntime(@NotNull CompilerSpecialMode mode) {
|
||||
return mode == REGULAR;
|
||||
}
|
||||
|
||||
public static boolean includeJdk(@NotNull CompilerSpecialMode mode) {
|
||||
return mode != IDEA;
|
||||
}
|
||||
}
|
||||
|
||||
-12
@@ -28,18 +28,6 @@ public enum CompilerSpecialMode {
|
||||
JS,
|
||||
;
|
||||
|
||||
public boolean includeJdkAnnotations() {
|
||||
return this == REGULAR || this == STDLIB || this == IDEA;
|
||||
}
|
||||
|
||||
public boolean includeKotlinRuntime() {
|
||||
return this == REGULAR;
|
||||
}
|
||||
|
||||
public boolean includeJdk() {
|
||||
return this != IDEA;
|
||||
}
|
||||
|
||||
public boolean isStubs() {
|
||||
return this == BUILTINS || this == JDK_HEADERS;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,10 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode.IDEA;
|
||||
import static org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode.REGULAR;
|
||||
import static org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode.STDLIB;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
@@ -52,14 +56,14 @@ public class CompileCompilerDependenciesTest {
|
||||
|
||||
public static CompilerConfiguration compilerConfigurationForTests(@NotNull CompilerSpecialMode compilerSpecialMode, boolean mockJdk) {
|
||||
List<File> classpath = new ArrayList<File>();
|
||||
if (compilerSpecialMode.includeJdk()) {
|
||||
if (includeJdk(compilerSpecialMode)) {
|
||||
classpath.add(mockJdk ? JetTestUtils.findMockJdkRtJar() : PathUtil.findRtJar());
|
||||
}
|
||||
if (compilerSpecialMode.includeKotlinRuntime()) {
|
||||
if (includeKotlinRuntime(compilerSpecialMode)) {
|
||||
classpath.add(ForTestCompileRuntime.runtimeJarForTests());
|
||||
}
|
||||
File[] annotationsPath = new File[0];
|
||||
if (compilerSpecialMode.includeJdkAnnotations()) {
|
||||
if (includeJdkAnnotations(compilerSpecialMode)) {
|
||||
annotationsPath = new File[]{ForTestPackJdkAnnotations.jdkAnnotationsForTests()};
|
||||
}
|
||||
|
||||
@@ -68,4 +72,16 @@ public class CompileCompilerDependenciesTest {
|
||||
configuration.putUserData(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, annotationsPath);
|
||||
return configuration;
|
||||
}
|
||||
|
||||
private static boolean includeJdkAnnotations(@NotNull CompilerSpecialMode mode) {
|
||||
return mode == REGULAR || mode == STDLIB || mode == IDEA;
|
||||
}
|
||||
|
||||
public static boolean includeKotlinRuntime(@NotNull CompilerSpecialMode mode) {
|
||||
return mode == REGULAR;
|
||||
}
|
||||
|
||||
public static boolean includeJdk(@NotNull CompilerSpecialMode mode) {
|
||||
return mode != IDEA;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user