Refactor command-line interface to kotlin-preloader.jar

Use reasonable defaults for the options: no time profiling, no instrumenters,
empty classpath, 4096 as the class number estimate. Replace 4096 in the
codebase with the constant field.

Keep the old interface intact until the build is bootstrapped and the new one
can be used in all compilation steps
This commit is contained in:
Alexander Udalov
2015-08-11 19:13:28 -07:00
parent a592b42357
commit aba6ab1299
7 changed files with 144 additions and 82 deletions
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.cli.js.K2JSCompiler;
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler;
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime;
import org.jetbrains.kotlin.preloading.ClassPreloadingUtils;
import org.jetbrains.kotlin.preloading.Preloader;
import org.jetbrains.kotlin.utils.PathUtil;
import org.jetbrains.kotlin.utils.UtilsPackage;
@@ -228,7 +229,9 @@ public class MockLibraryUtil {
private static synchronized ClassLoader createCompilerClassLoader() {
try {
File kotlinCompilerJar = new File(PathUtil.getKotlinPathsForDistDirectory().getLibPath(), "kotlin-compiler.jar");
return ClassPreloadingUtils.preloadClasses(Collections.singletonList(kotlinCompilerJar), 4096, null, null, null);
return ClassPreloadingUtils.preloadClasses(
Collections.singletonList(kotlinCompilerJar), Preloader.DEFAULT_CLASS_NUMBER_ESTIMATE, null, null, null
);
}
catch (Throwable e) {
throw UtilsPackage.rethrow(e);