Switch to templates in the separate script runtime

This commit is contained in:
Ilya Chernikov
2016-10-11 10:03:41 +02:00
parent c2b5c11781
commit 846797ff61
36 changed files with 99 additions and 128 deletions
@@ -344,6 +344,7 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
}
if (!arguments.noStdlib) {
classpath.add(paths.runtimePath)
classpath.add(paths.scriptRuntimePath)
}
// "-no-stdlib" implies "-no-reflect": otherwise we would be able to transitively read stdlib classes through kotlin-reflect,
// which is likely not what user wants since s/he manually provided "-no-stdlib"
@@ -122,8 +122,16 @@ public class CompileEnvironmentUtil {
if (!runtimePath.exists()) {
throw new CompileEnvironmentException("Couldn't find runtime library");
}
File scriptRuntimePath = PathUtil.getKotlinPathsForCompiler().getScriptRuntimePath();
if (!scriptRuntimePath.exists()) {
throw new CompileEnvironmentException("Couldn't find script runtime library");
}
JarInputStream jis = new JarInputStream(new FileInputStream(runtimePath));
copyJarImpl(stream, runtimePath);
}
private static void copyJarImpl(JarOutputStream stream, File jarPath) throws IOException {
JarInputStream jis = new JarInputStream(new FileInputStream(jarPath));
try {
while (true) {
JarEntry e = jis.getNextJarEntry();