Build kotlin-reflect.jar in build.xml and for Maven

Reflection will be distributed in a separate jar and not in kotlin-runtime.jar
for two primary reasons:
- Reflection implementation at the moment takes almost 2Mb
- Separate libraries for separate features is a technique encouraged by Maven,
  and it's inconvenient to make it different in the compiler distribution
This commit is contained in:
Alexander Udalov
2014-12-05 11:38:43 +03:00
parent 2c8754a6af
commit 2b090e02a1
11 changed files with 159 additions and 91 deletions
@@ -18,12 +18,15 @@ package org.jetbrains.kotlin.integration;
import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime;
import org.jetbrains.kotlin.utils.UtilsPackage;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ -40,13 +43,16 @@ public class CompilerSmokeTest extends KotlinIntegrationTestBase {
}
private int runCompiler(String logName, String... arguments) throws Exception {
String classpath = getCompilerLib().getAbsolutePath() + File.separator + "kotlin-compiler.jar" + File.pathSeparator +
getKotlinRuntimePath();
Collection<String> javaArgs = new ArrayList<String>();
javaArgs.add("-cp");
javaArgs.add(classpath);
javaArgs.add(UtilsPackage.join(Arrays.asList(
getCompilerLib().getAbsolutePath() + File.separator + "kotlin-compiler.jar",
ForTestCompileRuntime.runtimeJarForTests().getAbsolutePath(),
ForTestCompileRuntime.reflectJarForTests().getAbsolutePath()
), File.pathSeparator));
javaArgs.add("org.jetbrains.kotlin.cli.jvm.K2JVMCompiler");
Collections.addAll(javaArgs, arguments);
return runJava(logName, ArrayUtil.toStringArray(javaArgs));
@@ -81,7 +87,8 @@ public class CompilerSmokeTest extends KotlinIntegrationTestBase {
String jar = tmpdir.getTmpDir().getAbsolutePath() + File.separator + "smoke.jar";
assertEquals("compilation failed", 0, runCompiler("Smoke.compile", "-module", "Smoke.ktm", "-d", jar));
runJava("Smoke.run", "-cp", jar + File.pathSeparator + getKotlinRuntimePath(), "Smoke.SmokePackage", "1", "2", "3");
String classpath = jar + File.pathSeparator + ForTestCompileRuntime.runtimeJarForTests().getAbsolutePath();
runJava("Smoke.run", "-cp", classpath, "Smoke.SmokePackage", "1", "2", "3");
}
@Test